Skip to content

Instantly share code, notes, and snippets.

@BDQ
Created May 16, 2012 16:14
Show Gist options
  • Save BDQ/2711760 to your computer and use it in GitHub Desktop.
Save BDQ/2711760 to your computer and use it in GitHub Desktop.
compile_styles: function(){
var palette = Spraycan.palettes.find(function(palette){ return palette.get('active') });
var config_template = JST["spraycan/templates/shared/less_config"];
var less_css = config_template({ palette: palette});
less_css += window.frames[0].$jQ('style#source')[0].textContent;
var parser = less.Parser();
parser.parse(less_css, function(error, result){
if(error == null){
if(window.frames[0].$jQ("style#compiled").length==0){
window.frames[0].$jQ("head").append("<style id='compiled'></style>");
}
window.frames[0].$jQ("style#compiled").html(result.toCSS());
}
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment