Live data from Hacker News

Mincss "clears the junk out of your CSS"

peterbe.com

11–20 of 52 posts

Re: Mincss "clears the junk out of your CSS"

#12

The problem I have with these CSS mini programs is that a 'dynamic' site might not always load the css on each page, unless under certain specific circumstances. i.e. what about ajax calls that result in a new div showing? or a responsive CSS file with media queries depending upon the size of the screen?

What about a program into which you could feed your pre-processed dynamic documents (php, asp, etc) along with the CSS? I could see myself using that.

Re: Mincss "clears the junk out of your CSS"

#13

The problem I have with these CSS mini programs is that a 'dynamic' site might not always load the css on each page, unless under certain specific circumstances. i.e. what about ajax calls that result in a new div showing? or a responsive CSS file with media queries depending upon the size of the screen?

What about a program into which you could feed your pre-processed dynamic documents (php, asp, etc) along with the CSS? I could see myself using that.

The problem is there are often too many variables, i.e. what if a username is "blue" for a boy, "red" for a girl (or something like that).

And PHP etc is too dynamic.

Personally I think the 'best' option is a program which 'records' you using the site, and as a Dev I could use my site for like 30mins, touching each point of key functionality. Then at the end, review what sections of CSS were never used, and pick and choose what to discard based upon that (i.e. I can manually then check for fringe cases I might know of).

Re: Mincss "clears the junk out of your CSS"

#14
Is it feasible to find superfluous statements?

Ex: A line of CSS that sets text color of li tags to something, but every li tag already would be that color because of a CSS statement for body.

I'm guessing it'd be hard to build something useful and correct, but I think it'd be an interesting extension of this idea.

Re: Mincss "clears the junk out of your CSS"

#15

The problem I have with these CSS mini programs is that a 'dynamic' site might not always load the css on each page, unless under certain specific circumstances. i.e. what about ajax calls that result in a new div showing? or a responsive CSS file with media queries depending upon the size of the screen?

I see it as:

[] You feed in all URLs at once;

`urls = ["/", "/sign_up/", "/about/",]`

[] It pre-proccesses also JS files and tries to match CSS selectors as well. That would work for jQuery and Zepto!

`$("#foo").html($("").addClass("bar"))`

Edit: Okay, that won't work for `addClass`! :)

Re: Mincss "clears the junk out of your CSS"

#17

The problem I have with these CSS mini programs is that a 'dynamic' site might not always load the css on each page, unless under certain specific circumstances. i.e. what about ajax calls that result in a new div showing? or a responsive CSS file with media queries depending upon the size of the screen?

When dealing with a dynamic site or complete web application I think this would work best when tied into Selenium tests (or a similar integrated test framework).

Re: Mincss "clears the junk out of your CSS"

#19

The problem I have with these CSS mini programs is that a 'dynamic' site might not always load the css on each page, unless under certain specific circumstances. i.e. what about ajax calls that result in a new div showing? or a responsive CSS file with media queries depending upon the size of the screen?

How about running it as a background to the website, over say, a month, at the end of which you'd have pretty good confidence that you'd have hit all paths.
Post reply on HN