nottinghamcollege / HTML-Email-Boilerplate-Redux

A rewrite of the original HTML email boilerplate (originally written by Sean Powell) that keeps up with the latest developments of email clients, providing a solid foundation for our email campaigns, and yours too!
MIT License
79 stars 15 forks source link

Last css declaration in block does not end in ";" #14

Closed dyspop closed 7 years ago

dyspop commented 7 years ago

I'm thinking this is probably more likely a gulp issue, but calling it out here first in case the author(s) know something I don't

examples:

a[x-apple-data-detectors]{color:inherit!important;text-decoration:none!important;font-size:inherit!important;font-family:inherit!important;font-weight:inherit!important;line-height:inherit!important}
table#gmailapp-android-fix{display:none}
dyspop commented 7 years ago

but the actual declarations contain the ; https://github.com/centralcollegenottingham/HTML-Email-Boilerplate-Redux/search?utf8=%E2%9C%93&q=table%23gmailapp-android-fix

jamesmacwhite commented 7 years ago

Hi.

Its part of the minifying process when running gulp. Basically in order to save on file size, safe CSS optimisations are being run on the boilerplate. As far as I know, this shouldn't cause any issues with email clients, as its it is valid CSS for the last inline rule to not be ended with a semi colon, it also only happens on the last CSS inline rule.

Its certainly valid for CSS2:

http://www.w3.org/TR/CSS2/syndata.html#declaration

If however there is a specific usage case where this causes issues with an email client, I'll investigate further. The optimisation of removing the semi-colon isn't that much, but it helps.

dyspop commented 7 years ago

is there an option to disable?

jamesmacwhite commented 7 years ago

Not currently. The behaviour is coming from:

https://github.com/jakubpawlowicz/clean-css

There are various configuration options that can be applied in the gulpfile, I can see if there is a specific parameter that controls it from the docs and potentially work it as a user controlled configuration option, but it might not be an explicit option in clean-css, just a optimisation part of a general parameter.

Is there any reason why you want to disable it? It shouldn't harm anything and you do get a slight optimisation on file size,

jamesmacwhite commented 7 years ago

As discussed, I'll close this issue for now, if however clean-css choose to implement this as a boolean setting, I'll happily implement into our project as a user controllable option.