Reader small image

You're reading from  React Components

Product typeBook
Published inApr 2016
Publisher
ISBN-139781785889288
Edition1st Edition
Tools
Right arrow
Author (1)
Christopher Pitt
Christopher Pitt
author image
Christopher Pitt

Christopher Pitt is a principal developer for SilverStripe in Wellington, New Zealand. He usually works on open source software, though sometimes you'll find him building compilers and robots.
Read more about Christopher Pitt

Right arrow

Organizing styles with Sass


Style sheets are a great alternative to inline component styles. CSS is wonderfully expressive as a language for finding and applying visual characteristics to elements.

Unfortunately, it also has drawbacks. The biggest drawback to CSS is that all styles are in global scope. Some styles are inherited, and styles applied to elements often collide (and cancel each other out).

In small doses, the collisions are avoidable or manageable. In large doses, these collisions can cripple productivity. As a stop-gap, CSS supports the !important keyword. This often leads to ugly hacks, as everyone wants their styles to be the most important.

In addition to this, common values need to be repeated. Until recently, CSS didn't even support calculated values. If we wanted an element to have an absolute width (for example) in relation to other elements, we had to use JavaScript.

These are some of the problems Sass aims to solve. It's a CSS superset language (CSS + other features), so...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
React Components
Published in: Apr 2016Publisher: ISBN-13: 9781785889288

Author (1)

author image
Christopher Pitt

Christopher Pitt is a principal developer for SilverStripe in Wellington, New Zealand. He usually works on open source software, though sometimes you'll find him building compilers and robots.
Read more about Christopher Pitt