7

Minifying JS and CSS is quite common. The benefits of minifying JS are much greater that those seen with CSS because with CSS you can't rename elements - and same goes for HTML. But what if all 3 were minified together so that the benefits of using shorter names can be brought to CSS and HTML? That is, instead of minifying without any regard to the relationships between the 3, these could be preserved and made simpler. I imagine that the implementation could be quite difficult but if it were possible, do you think it would provide a significant advantage over traditional minification?

5 Answers 5

6

Probably not a significant benefit. If you gzip all your web content, then you will get the benefits of compression without the added complexity of all that minifying. And, you'll compress all the content on your pages too, which is hopefully a significant portion of your page volume.

3

I imagine that the implementation could be quite difficult but if it were possible, do you think it would provide a significant advantage over traditional minification?

Minification does matter and this largely depends on amount of scattered pieces of text. Yahoo's YSlow and Google's Page Speed both do talk about all three and provide solutions such as saving the minified version from within themselves.

So it is good idea to minify where there is room for it and performance is critical.

3

Note that using GZIP solves many problems. gzipping responses is efficient if there is a lot of repeated text - for example your css classes. So instead of using a complex minification tool, use gzip.

1

Probably much less advantage than minifying JS, since you definitely can't change the CSS style attribute names. Most of the time, those take up the most space in CSS files. All you can do is shortening ID/class names and removing superfluous whitespace. I'd guess average savings of somewhere around 10% in the HTML/CSS part.

Also, what Greg said.

-1

This will be of your interest

2
  • 1
    How is that relevant? LessCSS is a more covenient editing environment for CSS, but the resulting files are regular non-minified CSS. Commented Dec 28, 2010 at 8:52
  • Less does do some very minimal compression but I find that it averages out in the end because it can cause extra selector code if you aren't careful. But yeah, Less is not a minifier.
    – Chuck Vose
    Commented Dec 28, 2010 at 16:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.