Created
August 19, 2015 20:16
-
-
Save daffl/a6bce3e844083ab882a3 to your computer and use it in GitHub Desktop.
A LESS JS system plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var less = require('less'); | |
exports.translate = function(load) { | |
return less.render(load.source).then(function(output) { | |
return output.css; | |
}); | |
} | |
exports.instantiate = function(load) { | |
load.metadata.format = 'css'; | |
load.metadata.execute = function() { | |
var styles = document.createElement('style'); | |
styles.appendChild(document.createTextNode(load.source)); | |
document.head.appendChild(styles); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment