HTML and CSS Reference
In-Depth Information
CHAPTER 5
■ ■ ■
Managing CSS Files
A t this stage in the topic, you should be well on your way to creating professional-level web-
sites and applications using modern techniques. You've got semantic, clean, and valid (X)HTML
under your belt; you've had a refresher course on the basics of how CSS works; and you've seen
how the varied browser landscape can be tamed with a good grading chart and some policies
regarding the level of support you'll give to each grade of browser. Now we'll move on to the
practical, production-time aspects of CSS—starting with how you manage the style sheet files
themselves.
As you delve into bigger projects, you'll find that CSS files can become unwieldy if they're
not well managed. There are several reasons why thinking ahead of time about where you'll
store style sheets, how you'll keep them readable, and how they can be optimized will increase
efficiency:
Whether you're a solo developer or part of a team, it's important that your files be read-
able by someone other than you—and this is doubly true for teams in which more than
one CSS author works on the same project. Although it may be tempting to obfuscate
your work for the sake of “job security,” the honest, transparent, and right thing to do is
prepare your style sheets for the day when you no longer maintain them.
Developing a set of consistent standards for yourself or your team will make you work
faster from project to project. If you do things the same way you did the last time, and
the time before that, you'll start to develop habits that will increase efficiency.
Style sheet files can be large, and it may be in the best interest of your server and budget
to optimize them for minimal bandwidth use by compressing the files into the smallest
possible format.
This chapter shows you how to approach these considerations. Whether you adopt the
suggestions we make in this chapter is a matter of personal preference. We'll provide you with
some options for managing files, and reasons why we personally prefer one or the other, but
ultimately you'll need to establish which methods work best for you on your own. The key thing
to take away from this chapter is not so much the techniques themselves but the fact that
giving CSS file management some forethought will pay off for you in the long run.
73
Search WWH ::




Custom Search