News for hackers. Stuff that matters.
Re:What CSS minifiers also leave behind by replete on Wednesday April 05, 2017 @07:21AM (#14041235)
Don't mean to squash any enthusiasm, but these types of 1byte optimization savings don't really have real-world benefits due to over-the-wire compression like gzip and Brotli.

A more interesting problem to solve, I think, is that of optimising CSS rules for browser rendering.

Re:What CSS minifiers also leave behind by phire on Wednesday April 05, 2017 @07:44AM (#14041342)
I think that there is merit in designing a minifier that is explicitly designed to optimise the gziped size rather than the uncompressed size.

Things like:

* Rearrange rules within the file to put similar rules within the sliding window.

* Rearrange rules so that tail of the last declaration of one rule and the start of the next selector create the longest possible common substring.

* Rearrange the order of declarations within the rules to maximize the length of common substrings that span two declarations, ie ": 2em;\nbackground-color: rgb("

Re:What CSS minifiers also leave behind by remy_luisant on Wednesday April 05, 2017 @04:50PM (#14045496)
I'm working on one, though I'm not sure if it will ever see the light of the day. I have four months of free time and if someone would feed and house me for that time, I'd do it and open source it.

Any sponsors? No? Didn't think so. Not even you, big G? Aww...

For now some minifiers do sort the values, which helps.

Re:What CSS minifiers also leave behind by thaunatos on Wednesday April 05, 2017 @05:38PM (#14045877)
Maybe open-source it anyways? :-)
Re:What CSS minifiers also leave behind by remy_luisant on Wednesday April 05, 2017 @06:30PM (#14046265)
I won't have it any other way.

The "not starving to death" thing is a bit of an issue on the way there... Well, I have savings, but...

And if I get a horrid job, then I won't have the energy. :P

Re:What CSS minifiers also leave behind by CapacitorSet on Wednesday April 05, 2017 @07:41AM (#14041337)
I partly agree. Though removing one or two bytes more than another minifier doesn't really matter that much, what matters is being able to deduplicate CSS as well as doing the usual whitespace elimination. SASS and SCSS seem to have a bit of a problem with duplicated CSS.
Re:What CSS minifiers also leave behind by 52-6F-62 on Wednesday April 05, 2017 @10:15AM (#14042215)
It's funny you should say that. I'm curious, do you have an example?

I'm engaging in this ugly probably unsightly (but helpfully quick and maintainable) practice in a project with a short developmental cycle right now, and I've yet to have any issues outside of temporarily forgetting that I have already globally defined a specific style or enclosed a style I thought I'd left global.

(It's a corp. annual report -- that my team got tasked with as a favour -- so it has some repeating styles, and others isolated between pages)

Re:What CSS minifiers also leave behind by bastawhiz on Wednesday April 05, 2017 @11:51AM (#14042987)
One of the main reasons these optimizations happen is actually to make compression better. If you have a mix of px/pt/cm/mm in your stylesheet, it's more than likely that making them consistent (in their smallest possible form) makes them more uniform, making them more compressible.

I used to have a doc with actual numbers, but I've since lost it. If I dig it up, I'll link it here.