Note that there are some explanatory texts on larger screens.

plurals
  1. POWhich combining css technique?
    primarykey
    data
    text
    <p>Which of the following would you say is the best way to go when combining files for CSS:</p> <p>Say I have a master.css file that is used across all pages on my website (page1.aspx, page2.aspx)</p> <p><strong>Page1.aspx</strong> - A specific page that has some unique css that is only ever used on that page, so I create a page1.css and it also uses another css grids.css</p> <p><strong>Page2.aspx</strong> - Another specific page that is different from all other pages on the site and is different to page1.aspx, I'll name this page2.aspx and make a page2.css this doesn't use grids.css</p> <p>So would you combine the scripts as:</p> <h2><strong>Option1:</strong></h2> <blockquote> <p>Combine scripts <strong><em>csshandler.axd?d=master.css,page1.css,grids.css</em></strong> when visiting page1<br> Combine scripts <strong><em>csshandler.axd?d=master.css,page2.css</em></strong> when visiting page2</p> </blockquote> <p><strong>Benefits</strong>: Page specific, rendering quicker since only selectors for that page need to be matched up no unused selectors</p> <p><strong>Drawback</strong>: Multiple combinations of master.css + page specific hence master.css has to be downloaded for each page</p> <h2><strong>Option2:</strong></h2> <p>Combine all scripts whether a page needs them or not </p> <blockquote> <p><strong>csshandler.axd?d=master.css,page1.css,page2.css,grids.css</strong> (master, page1 and page2)</p> </blockquote> <p>that way it gets cached as one. The problem is that rendering maybe slower since it will have to try and match EVERY selector in the css with selectors on the page even the missing ones, so in the case of page2.aspx that doesn't use grids.css the selectors in grids.css will need to be parsed to see if they are in page2 which means rendering will be slow</p> <p><strong>Benefits</strong>: One file will ever be downloaded and cached doesn't matter what page you visit</p> <p><strong>Drawback</strong>: Unused selectors will need to be parsed by the browser slower rendering</p> <h2><strong>Option3:</strong></h2> <p>Leave the master file on it's own and only combine other scripts (the benefit of this is because master is used across all pages there is a chance that this is cached so doesn't need to keep on downloading</p> <blockquote> <p>csshandler.axd?d=Master.css<br> csshandler.axd?d=page1.css,grids.css</p> </blockquote> <p><strong>Benefits</strong>: master.css file can be cached doesn't matter what page you visit. Not many unused selectors as page spefic is applied</p> <p><strong>Drawback</strong>: Initially minimum of 2 HTTP request will have to be made</p> <p>What do you guys think?</p> <p>Cheers</p> <p>DotnetShadow</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload