

A Better Way to Manage CSS and JS (+ source code) - legierski
http://blog.gathercontent.com/combine-and-compress-css-and-js-on-the-fly

======
stinky613
While I don't mind the concept proposed, a few things immediately caught my
eye:

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";

~~~
legierski
1) CSS on dev setup changes very often. Limiting number of <link>'s was one of
the goals.

2) It does not. The ' ' is actually a double space.

3) Point 2)

~~~
stinky613
Ahh double space, that makes much more sense. Sorry for not looking more
closely before posting.

------
true_religion
I've done this before and its far from the best way.

Pre-compilation is better and is CDN safe out-of-the-box.

------
Nikkau
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?

~~~
speg
_We’ll introduce server-side caching in the future, but a goal of this script
was to provide users with the latest CSS/JS at all times..._

~~~
inportb
Surely, it would be acceptable to microcache for a few seconds? It's rather
easy, with nginx in front.

------
brittohalloran
Rails 3 asset management / precompiling FTW

------
pie
Better than what? This doesn't mention any of the other asset management tools
out there.

~~~
legierski
Better than using only one file with all css inside

------
prisonguard
out of topic but couldn't help noticing shorthand php tags <?= ?> these make
me cringe

~~~
aasarava
Why? If your server is running PHP and you're not worried about confusion with
some other language processor, then why not use shorthand?

~~~
prodigal_erik
It's no longer a valid SGML processing instruction, which largely rules out
decades of tools for working with markup.

~~~
aasarava
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!

