Answer the question
In order to leave comments, you need to log in
How do you like a way to speed up the web?
Reason: sites with 10-20 js and the same amount of css. Why not make 1 file with all js, css, img[, html] on the fly and give it to the browser. For example, the browser sends a header that it can support "compiled" files, and the server also sends a header that it sends 1 file that needs to be processed.
Cons: it is obvious that there is more trouble, add. standards.
Pros: huge acceleration.
Something similar - SPDY.
What do you think?
Answer the question
In order to leave comments, you need to log in
uh... what?
concatenation of styles/scripts and their subsequent minification is a normal practice. For this, no standards are needed. Do it at least on the fly, at least collect it once during deployment (which would be logical), or even better, immediately put a version of your compiled files already compressed in gzip next to it. Again, I don’t see the point of making one of two files, at least for the following reason: styles must be loaded before scripts. At least in most cases anyway. Loading scripts should not block page loading.
As for SPDY - then you didn’t get a drop at all. There, the profit is that one tcp connection with the server and data multiplexing are used. This allows you to reduce the load on the server, not waste time connecting to the server again to download the next files, etc. In fact, when using this protocol, the concatenation of style files and scripts should not bring significant profit, because the connection will still be the same.
ps The article you cited is not in vain in the "abnormal programming" hub.
There are many optimization techniques, each one is suitable for a specific case:
- 1 html+css+js file: logical if there is no external code (eg jquery) and the site consists of 1 page.
- 3 html, css, js files: 3 files will be loaded for the first entry point to the site, only html for subsequent pages. css and js will be taken from the browser cache.
- 4 files html, css, js, img-sprites: small images are placed in a separate sprite, large images are loaded as is.
- n-files html, css, js, img-sprites: for the first entry point, html, basic css and js and page-specific css and js are loaded. for subsequent new html page specific css and js. basic already to the cache. suitable if a very large project, many different pages / subdomains in different styles, but with common bases. basic files are placed in a separate 3rd level domain or 2nd level domain (so that cookies are not sent or processed).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question