cfpb / regulations-site

(DEPRECATED) Web interface for viewing U.S. federal regulations and other regulatory information
Other
28 stars 43 forks source link

purifycss #738

Closed ascott1 closed 9 years ago

ascott1 commented 9 years ago

This adds purifycss, which looks for unused CSS selectors in the templates and JavaScript and removes them from the file.

##################################
Before purify, CSS was 155588 chars long.
After purify, CSS is 125229 chars long. (1.2 times smaller)
##################################
This function took:  713 ms

The savings are pretty minimal for this project, but it's something. ¯\_(ツ)_/¯

Review

@KimberlyMunoz

ascott1 commented 9 years ago

I'm honestly torn about this pull request. Is a 1.2% file savings worth implementing something this magical? I'd love thoughts.

KimberlyMunoz commented 9 years ago

I took a look at the minified source and saw it was removing some of the *asterisks before CSS properties that are being used for backwards compatibility. Since the star hack rule really only affects IE7 and earlier and since eRegs wouldn't work on those browsers, we should probably just look at removing the rules without the magic.

This is cool though and I think it could be useful on other projects, because Capital Framework can be ~bulky~.

ascott1 commented 9 years ago

My sentiments exactly! I'm going to close this, but it was a fun experiment. :sunglasses: