lesser of two evils: @import vs large stylesheet

over 6 years ago from Daniel Ypsilanti, Graphic Designer at UF

  • Marc EdwardsMarc Edwards, over 6 years ago (edited over 6 years ago )

    Have you looked into using SASS (SCSS) or LESS or some other CSS preprocessor?

    http://sass-lang.com

    Using SCSS, you can probably have the best of both worlds — a modular source, with lots of reusable components, and tiny CSS files (with all whitespace stripped) for each page.

    You could have something vaguely like this:

    • /scss/reset.scss
    • /scss/bass-styles.scss
    • /scss/course-01.scss
    • /scss/course-02.scss
    • /scss/course-03.scss

    That could combined reset and base-styles, then add the course specific other bits, generating:

    • course-01.css
    • course-02.css
    • course-03.css

    Plus, those generated CSS files could have all comments removed, all whitespace removed and be far smaller and faster to load.

    I use CodeKit to compile my SCSS, but there’s lots of different ways it can be done.

    6 points