Ask YC: How to avoid front-end clutter?
I suppose most front-end developers/designers heard of this problem before: too much CSS and Javascript files and too much declarations in 'em. After a while it gets hard to find your way around all the classes in there and add or fix things. Next to that you might scratch certain server-side code and forget to update the client-side bits. We tried to fix this by creating a lot of different CSS/JS files but sometimes certain declarations span across different site sections and you end up looking for them in the wrong place anyway.
How do you guys combat the mess you automatically make in the front-end? Do you use frameworks like Blueprint or perhaps SASS? I still haven't found any structure or convention that kind of forces me to do it DRY and neat, like for instance RoR has done for me. Maybe it's time to create a standard for this, or just to create some naming pattern to map front-end code to server-side? Or maybe that already exists?
Any thoughts?
(I hope I didn't explain this too vague, I'm trying hard not to)
7 comments
[ 3.6 ms ] story [ 35.9 ms ] threadHaml & Sass make the process so much less painful.
With CSS I really think the best answer is one monolithic CSS file. Add a index at the top and keep it organized by global, section and page: http://www.flugpo.com/FlugPo/styles/style.css
With JS I find breaking it down by section files alone with one global file to be the best way to approach it.
As for organization of files, I use something called "alltemplates" that I have no idea where I found. It's basically just an organized file similar to what STHayden describes. Email me at bjclark =at= inigral dotter com and I'll send a zip with the blank templates I start with.
Third, I use BlueprintCSS.
Forth, I use a form framework, for RoR I'm using http://github.com/jlindley/accessible_form_builder/tree/mast... which has blueprint support and for static pages/sites I use Khoi Vihn's "GoodForm" which is old, stagnant, and all I've ever needed (with my own modifications).