Skip to Content
CSS in Depth
book

CSS in Depth

by Keith Grant
March 2018
Intermediate to advanced content levelIntermediate to advanced
472 pages
13h 5m
English
Manning Publications
Content preview from CSS in Depth

Appendix B. Preprocessors

Using a preprocessor is a vital part of a modern CSS workflow. A preprocessor provides a number of conveniences to streamline your writing and to help you maintain your codebase. For instance, you can write a piece of code once and then re-use it throughout your stylesheet.

A preprocessor works by taking a source file, which you write, and translating it into an output file, which is a regular CSS stylesheet. In most cases, the source file looks much like regular CSS, but with extra features added. A simple example using a preprocessor variable looks like this

$brand-blue: #0086b3;

a:link {
  color: $brand-blue;
}

.page-heading {
  font-size: 1.6rem;
  color: $brand-blue;
}

This code snippet defines a variable named $brand-blue ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

CSS: The Definitive Guide, 4th Edition

CSS: The Definitive Guide, 4th Edition

Eric Meyer, Estelle Weyl
Tailwind CSS

Tailwind CSS

Ivaylo Gerchev

Publisher Resources

ISBN: 9781617293450Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentPurchase Link