A Better Way to Manage CSS and JS (+ source code)(blog.gathercontent.com)
blog.gathercontent.com
A Better Way to Manage CSS and JS (+ source code)
http://blog.gathercontent.com/combine-and-compress-css-and-js-on-the-fly
7 comments
I've done this before and its far from the best way.
Pre-compilation is better and is CDN safe out-of-the-box.
Pre-compilation is better and is CDN safe out-of-the-box.
So on the fly you open tons of text files to glue them? Seems i/o intensive.
Why not do the same thing on deploy?
Why not do the same thing on deploy?
Or, do the best of both worlds.
Get your web server involved and it becomes brainless:
http://www.gethifi.com/blog/Automatic-file-minification-on-n...
Get your web server involved and it becomes brainless:
http://www.gethifi.com/blog/Automatic-file-minification-on-n...
+1
Not to mention that a stylesheet named "_dynamic.php?v=blehbleh&lx=12&vs=4.3.3" isn't really welcome.
Rails 3 asset management / precompiling FTW
out of topic but couldn't help noticing shorthand php tags <?= ?> these make me cringe
Why? If your server is running PHP and you're not worried about confusion with some other language processor, then why not use shorthand?
It's no longer a valid SGML processing instruction, which largely rules out decades of tools for working with markup.
I'm curious as to what tools you're using to work with files containing PHP code. I mean that sincerely -- if you've got something you really like, it'd be great to learn something new!
Can you give me an example? I was honestly surprised that the shorthand PHP syntax would ever be an issue.
1) How often are changes made to these CSS files? It seems to me that caching would be far more crucial than any marginal benefit of this practice. Also, what of allowing multiple CSS files to download in parallel via multiple <link> tags?
[nitpicking from here out]
2) Why does his minify code remove all whitespace and then remove whitespace before '{' and after ':'? They're already gone.
3) Removing all whitespace makes the assumption that no whitespace is necessary. This will completely break, among other things, font-family: "Some Embedded Font";