Why the missing semicolons on all default CSS files?

Permalink
It's needlessly bad practice - I don't understand why it's done this way. Leaving off semicolons for each last declaration makes it extremely easy to create major headaches.

Excerpt from /concrete/themes/default/typography.css

h1,h2,h3,h4,h5{ margin:0px 0px 4px 0px; padding:4px 0px; margin-top:8px }
h1{ font: normal normal 21px Arial; line-height:28px }
h2{ font-size:18px; line-height:24px }
h3{ font-size:16px; line-height:21px }
h4{ font-size:14px; line-height:18px }
h5{ font-size:13px; line-height:16px }
p{ padding:0px 0px 0px 0px; margin:0px 0px 12px 0px; }


I recommend that if you need to touch the CSS at all, you start with a couple of search-and-replace scripts so that all
}
becomes
;}


Then, to correct any duplicate semicolons, search for
;;}
and replace with
;}

removemeplease
 
mhawke replied on at Permalink Reply
mhawke
I agree that this should be done but the core team probably feel that there are 'bigger fish to fry'. You could put in a pull request in GitHub and take that task on. I'm sure it would be appreciated.
removemeplease replied on at Permalink Reply
removemeplease
My first stab at GitHub... I'll try it.
JohntheFish replied on at Permalink Reply
JohntheFish
These may be auto generated from LESS, so best to check that with someone from the core before doing it, or you could be wasting your time.
mhawke replied on at Permalink Reply
mhawke
I'm not sure I understand your reference to LESS. Are you saying that the core team use LESS in their development environment and that's where the truncation is happening?

I'm not the slightest bit worried about the quality of the css found in typography.css in the default theme files but I do see lots of inconsistencies throughout the core css files in [root]/concrete/css. Does the css spec mandate a trailing semicolon?

I can see some instances where leaving it off can cause problems but I'm sure there are also tons of add-ons that are inconsistent as well. You might be chasing your tail on this one.
removemeplease replied on at Permalink Reply
removemeplease
I usually come at best practices from a "How To Teach A Novice" perspective. When teaching CSS, it's paramount that a novice gets into the habit of *always* remembering the trailing semicolon when making CSS declarations. If not, it is easy to waste time scratching heads and pulling hair wondering why styles are not showing up as expected.
JohntheFish replied on at Permalink Reply
JohntheFish
LESS is used in the core. But I don't know if it is just the dashboard (bootstrap derived) or also in any of the themes.

Hence my caution to find out more before putting effort into changes.
removemeplease replied on at Permalink Reply
removemeplease
Yeah... it's a simple fix but you're right - if they're using LESS then it's a fix that would have to happen every new version they push out, I assume.
Phallanx replied on at Permalink Reply
Phallanx
It's a generally accepted best practice for optimisation to save a few bytes (more trouble than it's worth IMHO).

e.g.http://www.queness.com/post/588/15-ways-to-optimize-css-and-reduce-...
removemeplease replied on at Permalink Reply
removemeplease
This is what I assumed - an attempt to save "a few bytes". But MHO agrees with you - more trouble than it's worth.