Mittwoch, 11. Juni 2014

Sharing Data Between Sass and JavaScript with JSON




CSS-Tricks





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








Keine Kommentare:

Kommentar veröffentlichen