So if I have a large site driven by a web content management system and each page uses different parts of the css, how can we leverage this? Does it mean we have to generate different css files for each page? or have a dynamically generated css file for each page?
Mincss "clears the junk out of your CSS"
31–40 of 52 posts
Re: Mincss "clears the junk out of your CSS"
#32Re: Mincss "clears the junk out of your CSS"
#33The other issue, is that it is all to often that user events trigger the adding, subtracting or refactoring selectors.
How does this handle these scenarios?
Re: Mincss "clears the junk out of your CSS"
#34To echo other sentiments on this page, how does this work with a one page, ajax application? The other issue, is that it is all to often that user events trigger the adding, subtracting or refactoring selectors. How does this handle these scenarios?
That said, I am sure that static sites/non-JS intensive sites might be able to use this.
Re: Mincss "clears the junk out of your CSS"
#35Quote:
How does it work?
- Open up the first page of the site you want to check and press the "Scan" button in the "CSS Coverage" Firebug tab.
- In case of a rich (Ajax or DHTML) site, open up as many divs/popups/tabs in the page as possible and press "Scan" again.
- Visit other pages of your site and press "Scan" again.
Each time you press "Scan", the CSS files that are included in the current page are shown with the number of times the rules has been found applied on your page before it.
[1] https://addons.mozilla.org/en-us/firefox/addon/css-usage/
Re: Mincss "clears the junk out of your CSS"
#36A few years ago I wrote a python script which does this and more. It inlines the CSS to the page and reduces it to only the used CSS rules [1]. Additionally, my version can also inline the page images as base-64 encoded blocks. Cheers! [1] https://github.com/jaytaylor/python-inlineify-html
Check this out for a use case where I apply mincss and gain a massive performance boost: http://www.peterbe.com/plog/mincss-in-action
Re: Mincss "clears the junk out of your CSS"
#37So if I have a large site driven by a web content management system and each page uses different parts of the css, how can we leverage this? Does it mean we have to generate different css files for each page? or have a dynamically generated css file for each page?
You can feed mincss a bunch of different URLs and or different .html files and it'll work out the CSS in that. (Note: even if you feed it the raw HTML as a string you need to give it a URL) Or, you do one page at a time. However that's slow and will only be an option if you have serious caching. See http://www.peterbe.com/plog/mincss-in-action
Re: Mincss "clears the junk out of your CSS"
#38A few years ago I wrote a python script which does this and more. It inlines the CSS to the page and reduces it to only the used CSS rules [1]. Additionally, my version can also inline the page images as base-64 encoded blocks. Cheers! [1] https://github.com/jaytaylor/python-inlineify-html
Re: Mincss "clears the junk out of your CSS"
#39thank you, I was looking for something like this, have to keep the label "use with caution". but great work
Re: Mincss "clears the junk out of your CSS"
#40I've been meaning to port it to node and run it with a headless browser. Contributions are always welcome.