Created
November 8, 2011 18:58
-
-
Save sebastianhoitz/1348738 to your computer and use it in GitHub Desktop.
Hem + Less Bug
This file contains hidden or 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 hem = new (require('hem')); | |
var less = require('less'); | |
var fs = require('fs'); | |
var argv = process.argv.slice(2); | |
hem.compilers.less = function(path) { | |
var content, result; | |
content = fs.readFileSync(path, 'utf8'); | |
result = ''; | |
less.render(content, function(err, css) { | |
if (err) { throw err; } | |
result = css; | |
console.log("Bar"); | |
}); | |
console.log("Foo"); | |
return result; | |
}; | |
require.extensions['.less'] = function(module, filename) { | |
var source; | |
source = JSON.stringify(hem.compilers.less(filename)); | |
return module._compile("module.exports = " + source, filename); | |
}; | |
hem.exec(argv[0]); | |
// outputs Foo Bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment