3 ms·
I dream of a day when you can have CSS loaded that has no dead weight. If one page doesn't have an accordion, there's no point in it loading the accordion CSS.
by partiallypro 10y ago
I dream of a day when you can have CSS loaded that has no dead weight. If one page doesn't have an accordion, there's no point in it loading the accordion CSS. Foundation slimmed down their base CSS files because it had so much dead weight from 5 to 6; but I wish there were some way (and I have seen some projects on GitHub) that I could load a page and it only would load the CSS needed for that page, but would still cache the common assets.
- onion2k 10y agoWhat problem would that solve?
- partiallypro 10y agoYour server serving up tons of code that is not being used at all?
- onion2k 10y agoThat would assume the user is only going to view one page. If they look at several pages then it'd be better to have sent all the CSS necessary in the first request and have their browser cache it. If you only send the styles necessary for the page they're looking at then you lose all the benefits of caching. That's a far bigger problem than sending a bunch of unused code.
- CM30 10y agoIsn't this basically using a default 'main' CSS file and a bunch of small extra ones loaded on a per page basis? You can do that pretty much simply with most CMSes out there, or through rudimentary scripting. Though being able to do that with a single CSS file would be nice to see...