andrewrk / juice

Juice inlines CSS stylesheets into your HTML source.
MIT License
60 stars 13 forks source link

Option removeStyleTags='keepMediaQueries' #3

Closed jrit closed 10 years ago

jrit commented 10 years ago

I'm currently using removeStyleTags=false only to maintain media queries in the output. It would make more sense to only include the media queries and not all the CSS that has already been inlined, so I'm considering adding this as an option.

I'm debating adding a removeStyleTagsExceptMediaQueries as a more selective version of removeStyleTags but am not a big fan of that name or adding another boolean. I think the cleaner way is to have an option that defines what to do with style tags, like removeStyleTags=true|'keepMediaQueries'. Based on the way I read the code right now, making that change would be non-breaking as long as the true value continues to be truthy like it looks now and any new string match could be strict.

Do you have any thoughts on this?

Thanks for maintaining this fork.

jrit commented 10 years ago

Possibly keeping @import statements would be worth thinking about at the same time. Anyway, just wanted to get your input before starting on anything.

andrewrk commented 10 years ago

I typically prefer to pretend that variables have types and not intentionally assign different types to them. I don't think another boolean is such a bad idea - it could be called preserveMediaQueries.

That said if you implemented it the way you suggested and with a nice test case for it, I'll still merge it.