best practices

Keeping CSS tidy makes themers happy!

We all know the infamous style.css file, and how easy is open it up in your text editor and start to dump code in to the infinite and beyond. Even though things have changed a little bit with D6 and the .info file, look at your CSS for any given site and ask yourself, "is this what we really want, a huge file where we dump everything?"

When you finish the first version of your theme, things may look nice. The CSS is clean, you have selectors grouped following your desired criteria, maybe you have some comments to help separate these groups, etc. But then another develper opens your file to make some edits, and the disaster has begun.

The next developer is not going to go through the hundreds, or possibly thousands, of lines of code that you have added, just to have an idea where they should place his/her new selectors. That person doesn't even know if the new style is going to overwrite your work, so after the code is placed they do a quick look at the page, and if everything looks awesome, the work is done.

Syndicate content