Sporniket Studio
A methodology for CSS (2)
29 Septembre 2008 — 22:30
Using a master file
In order to be able to maintain , One has to understand what does a stylesheet in order to be able to maintain it. Our ability to understand is reduced when the number of rules is becoming high enough.
The usual solution to this problem consists in grouping rules that are somehow related in separated units, one CSS file by unit.
Then, one loads each unit either from the HTML page or through a master file that is in charge of loading them.
I recommand the latter, because in this case the HTML page does not have to care with the stylesheet organisation. In other words, subfile might be added or removed, the HTML page will not change.
Example
Here is the master file of sporniket-studio.com, as of the day I wrote this article :
@import "_base.css"; @import "_global.css"; @import "_part_accessibility.css"; @import "_part_header.css"; @import "_part_body.css"; @import "_part_poster.css"; @import "_part_footer.css";