Created
October 3, 2010 19:30
-
-
Save visnup/608843 to your computer and use it in GitHub Desktop.
I know: it's blasphemy. whatever.
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
// if you have the ruby sass gem installed, use the `sass` executable from it to | |
// generate css instead of the incomplete sass.js implementation. | |
express.compiler.compilers.sass.compile = function(str, fn) { | |
try { | |
var sass = require('child_process').spawn('sass', ['--stdin']), | |
append = function(data) { css += data; }, | |
css = ''; | |
sass.stdout.on('data', append); | |
sass.stderr.on('data', append); | |
sass.on('exit', function(code) { | |
if (code === 0) | |
fn(null, css); | |
else | |
fn(new Error('sass exited with code: ' + code + '\n' + css)); | |
}); | |
sass.stdin.write(new Buffer(str)); | |
sass.stdin.end(); | |
} catch(err) { | |
fn(err); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment