Home > Web Design | Web Development > Sharing Data Between Sass and JavaScript with JSON

Sharing Data Between Sass and JavaScript with JSON

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 to ArticlePermalink


Sharing Data Between Sass and JavaScript with JSON is a post from CSS-Tricks

TOP
Visit Us On TwitterVisit Us On FacebookVisit Us On Google PlusVisit Us On Linkedin