6 ms·
A Better Way to Manage CSS and JS (+ source code)
- pie 14y agoBetter than what? This doesn't mention any of the other asset management tools out there.
- legierski 14y agoBetter than using only one file with all css inside
- Nikkau 14y agoSo on the fly you open tons of text files to glue them? Seems i/o intensive. Why not do the same thing on deploy?
- vhf 14y ago+1 Not to mention that a stylesheet named "_dynamic.php?v=blehbleh&lx=12&vs=4.3.3" isn't really welcome.
- speg 14y agoWe’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 14y agoSurely, it would be acceptable to microcache for a few seconds? It's rather easy, with nginx in front.
- JoelSutherland 14y agoOr, do the best of both worlds. Get your web server involved and it becomes brainless: http://www.gethifi.com/blog/Automatic-file-minification-on-nginx http://www.gethifi.com/blog/Automatic-file-minification-on-n...
- brittohalloran 14y agoRails 3 asset management / precompiling FTW
- true_religion 14y agoI've done this before and its far from the best way. Pre-compilation is better and is CDN safe out-of-the-box.
- prisonguard 14y agoout of topic but couldn't help noticing shorthand php tags <?= ?> these make me cringe
- aasarava 14y agoWhy? 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 14y agoIt's no longer a valid SGML processing instruction, which largely rules out decades of tools for working with markup.
- ufo 14y agoCan you give me an example? I was honestly surprised that the shorthand PHP syntax would ever be an issue.
- aasarava 14y agoI'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!
- prisonguard 14y agoout of topic but couldn't help noticing shorthand php tags <?= ?> these make me cringe
- stinky613 14y agoWhile 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";