I am working on a Rails 3.1 app and am happily using SASS and CoffeeScript. I particularly like the SASS extensions of variables and imports. I have constructed a single _global-settings.css.scss file which contains ALL of the hex constant values I use throughout all of my stylesheets. This gives me a single place to manage colors, fonts and layout dimensions. Very DRY.
But, if I wish to use JQuery to tweak my css dynamically, I no longer have access to my css compile-time variables, and must reproduce the same data as a JSON hash in a .js.coffee file. Not DRY at all.
Here is my question: Before I go off and build a rake task to munge my css settings file into an equivalent CoffeeScript hash, does anyone have a more clever idea? Like hiding all the values in a hidden div in an html file?
constants.ymlfile where you list your global values. Those can then be inserted into asset files via ERB, I believe. But I haven't tried it myself.constants.ymlthough, adding aYAML.load_filecall during application initialization would be easy enough if it wasn't automatic.constants.ymlanywhere so that's probably something that got dropped.