Modularizing CSS files -
many people keep number of external css , javascript files minimum reduce round trip time. example, google recommends maximum 2 css , javascript files per web site, respectively.
the problem is, i've broken css code several files depending on nature part of "modularization". example, i've put css code used in part of application in separate file. result, files have less hundred lines of code.
i'm java develper, , recommended practice in java, css totally different creature , don't know css. here questions.
does make sense keep many css files see fit readability , maintainability?
how many css files manageable in web project?
what's average number of css files in web applications you've worked on in past?
i agree other have said here, yes when develop have muliple css files, production should merge minify them.
however not agree should merge them 1 single file. mean people want visit home page must wait css on pages x,y,z download.
what have 2 or 3 css files.
- 1 small css file home page load super quick casual visitors not have wait see site about
- another css file every other page availble guest users
- another css file members sectons of website require login.
you can use scripts head.js manage css , javascript asynchronously
from there site http://headjs.com/
there common misbelief single combined script performs best. wrong:
- latest browsers , head js can load scripts in parallel. loading 3 parts in parallel instead of single chunk faster.
- if individual file changed whole combination changes , loose benefits of caching. it's better combine stable files doesn't change often.
- many popular libraries hosted on cdn. should take advantage of instead of hosting yourself
- iphone 3.x cannot cache files larger 15kb , in iphone 4 limit 25kb. , size before gzipping. if care iphones should respect these limits.
Comments
Post a Comment