Current time: 10-16-2019, 02:18 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
JS minifyng
01-04-2012, 01:59 PM
Post: #1
JS minifyng
Hi,
I have a site and I made a webpagetest http://www.webpagetest.org/result/111221...1/details/ and I realized that each JS file is wasting time because of the first time byte, I combined all the JS files together but most of the the combined JS files didn't work. Is it because it wasn't combined right or it can't be combined? Either way, is there a program that combines it for you (by adding a script)?
Thanks,
Hersh
Find all posts by this user
Quote this message in a reply
01-05-2012, 12:18 AM
Post: #2
RE: JS minifyng
Wow, I don't know that I've ever seen that many separate files. There are some fringe cases where you can't combine but usually it's a trivial effort of concatenating the files together. You just need to make sure that the order is maintained, the text encoding is the same (no unicode BOM's) and that the relevant files are still loaded before any inline script that depends on it.

If the javascript modifies the DOM then you are best off only combining chunks of code that are referenced from the HTML right after each other and not pull in code files from later in the document in case they depend on something in the HTML in between.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-05-2012, 10:13 AM
Post: #3
RE: JS minifyng
Thank you for replying.
How can I know which of the files are possible to combine.
Thank you,
Hersh.
Find all posts by this user
Quote this message in a reply
01-05-2012, 11:42 PM
Post: #4
RE: JS minifyng
Best way is to look at the page source and just combine files that are referenced right after each other without anything in between.

This chunk for example:

Code:
<script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/61zBQJTuojL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/11rTBaklV6L.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/11Wyia6dZRL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/11n18BfqlVL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/11hj0HzivoL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/518l61SpNVL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/01E7g5et9PL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/312PC%2BcCTSL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/41huVBHqHBL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/11CnqXAZA7L.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/21IDTX5GY4L.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/41QR2T0HdiL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/41VtLqPdPrL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/31fApiQ6hhL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/01YWXJhaWJL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/21IGgk7s%2BRL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/31LH4rzJ12L.js"></script>

and this one:

Code:
<script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/61QHBVNqcDL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/315tCwFHHZL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/21-gGTHofsL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/218f3bhzaRL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/11C1XEsIUlL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/01yCpMcDHRL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/311-YvlDsKL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/61-W9Z2lPXL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/21qoawMSkrL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/11euNUoTo%2BL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/011AS2GSaIL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/01kHJKwYtSL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/01dxX9hAIZL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/01q40IxtMnL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/41eS7fKBzZL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/11XAT70TuIL.js"></script>
  <script type="text/djs" data-djssrc="http://z-ecx.images-amazon.com/images/I/41-0caYX8RL.js"></script>

Are you using cloudflare? It looks like those are all generated dynamically and are from their rocket loader: http://wordpress.org/support/topic/wordp...cript-code

You'd want to modify the page before the optimizations (turn off all cloudflare optimizations and re-run the test).
Visit this user's website Find all posts by this user
Quote this message in a reply
01-06-2012, 09:26 AM
Post: #5
RE: JS minifyng
Thank you.
hersh.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)