Breakpoints and Tweakpoints in Sass

Just thought I’d mention that I’ve implemented this on a site I’m working on and it seems to work like charm. The only heads up is that if you @import your Sass-files like this:

  1. _config.scss
  2. _mixins.scss
  3. _component-1.scss
  4. _component-2.scss

…and you have a breakpoint-mixin doing some work in _component-1.scss (but only accessing the global $breakpoints list) and the same mixin accessing a local $tweakpoints-map in _component-2.scss, you’ll get a Sass compile error if you don’t instantiate an empty $tweakpoints-map in _config.scss. This is because the variable needs to exist the first time the mixin gets called.

Awesome idea Hugo – it really cleans up the global $breakpoints-map and makes my BEM-style .scss-files even more encapsulated and self-governed, without loosing the benefits of a global, shared breakpoint-map.