Grow your CSS skills. Land your dream job.

Sharing Data Between Sass and JavaScript with JSON

Published by Chris Coyier

Imagine you have a set of breakpoints you have defined for your design that adjust the layout. Now you need to mimic those breakpoints in JavaScript, because you are choosing to load some dynamic content at that breakpoint. Now you're maintaining that breakpoint at two different places in your code. Inefficient and error prone.

This idea by Nate Hunzaker allows you to define those breakpoints in a JSON file that can be used by Sass as well as JavaScript. And not just breakpoints, but any data you might need in both places: colors, layout information, perhaps user preferences?

Direct Link →

*May or may not contain any actual "CSS" or "Tricks".