1 css/js files per page VS 1 css/js files per site
-
Hello,
I made this observation :
The concatenated autoptimized css and js files are different for each page. The result is that each visited page loads a non cached autoptimize css and js file.
In my case the transfered size over network is on average 230kb (css) and 125kb (js). For each page the difference is around 2kb, so it gives this when browsing site :1st visited page :
css : autoptimize_1111111111.css –> 231kb
js : autoptimize_1111111111.js –> 124kb2nd visited page :
css : autoptimize_2222222222.css –> 229kb
js : autoptimize_2222222222.js –> 124kb3rd visited page :
css : autoptimize_3333333333.css –> 232kb
js : autoptimize_3333333333.js –> 126kb…. and so on.
From there I am not sure about 2 things, are those statements true ? :
-The difference is because the styles and scripts are not the same depending of the page so the concatenated files differ in order to include page specific code.
-It works this way because if we had one common file for the full site, this 2kb difference would make this common css/js file +2000kb if there are 1000 pages.
If those statements are true, here is what I am wondering :
Would it be possible to generate one common css/js file for the entire site AND for instance, inlining the specific code in the head/footer or generating a 2nd specific css/js file in order to efficiently use the browser cache and not reload 99% of the already loaded code ?
This way of handling files would give :1st visited page :
common css : autoptimize_common.css –> 225kb
common js : autoptimize_common.js –> 120kb
specific css : autoptimize_1111111111.css –> 6kb
specific js : autoptimize_1111111111.js –> 4kb2nd visited page :
common css : autoptimize_common.css –> 225kb – cached, not reloaded
common js : autoptimize_common.js –> 120kb – cached, not reloaded
specific css : autoptimize_2222222222.css –> 4kb
specific js : autoptimize_2222222222.js –> 4kb3rd visited page :
common css : autoptimize_common.css –> 225kb – cached, not reloaded
common js : autoptimize_common.js –> 120kb – cached, not reloaded
specific css : autoptimize_3333333333.css –> 7kb
specific js : autoptimize_3333333333.js –> 6kb…. and so on.
Is it possible to do this ?
What are the limitations/issues of handling css/js generation this way ?
- The topic ‘1 css/js files per page VS 1 css/js files per site’ is closed to new replies.