Re: [Cppcms-users] combining all js and css requests in a single file
Brought to you by:
artyom-beilis
From: Artyom <art...@ya...> - 2010-12-16 08:33:42
|
> Hi, > > My opinion in web development, specifically if we have many "js and > css" resources, although we have high performance http server, many > "js and css" requests will result poor performance (vary in case). > > A technique used in YUI javascript framework is with combining all > request in single file. They provide, named Combo API to access YUI > resources, complete with its dependency configurator. > Here the example of combining 4 javascript request: > > <script type="text/javascript" >src="http://yui.yahooapis.com/combo?2.8.2r1/build/yahoo/yahoo-min.js&2.8.2r1/build/dom/dom-min.js&2.8.2r1/build/event/event-min.js&2.8.2r1/build/element/element-min.js&2.8.2r1/build/tabview/tabview-min.js"></script> >> > > and for css: > > <link rel="stylesheet" type="text/css" >href="http://yui.yahooapis.com/combo?2.8.2r1/build/fonts/fonts-min.css&2.8.2r1/build/tabview/assets/skins/sam/tabview.css"> >> > > Combo API is useful to minimize http request. > > How about added this feature (combo api) in CppCMS so we don't need > combine it ourself? First of all, as far as I understand you can just use some css/javascript compressor and use it instead of ordinary file. And probably specialized compressors would do a good job. > How about combining small images so we can access it with css sprite? Isn't it what HTTP-Keep-Alive and for? Also HTTP/1.1 allows you to send several requests for different images without waiting for completion of downloading first one. Isn't it better? Generally most web servers know to serve static files a way better than any framework I know for a simple reason - this is what they are benchmarked against most often. They use best OS API like sendfile or others to do the job done. I'm not sure how much would it give you to push such thing in framework, also how exactly can you combine serveral images in single request? Artyom |