a4a43487e3
The file object passed by gulp is now a wrapped node file object. Clone seems to be tripping over the path setting resulting in .scss files rather than .css files. The content of the files is, as expected, css. This fix removes the file cloning and instead just emits the incoming file with modified attributes.
33 lines
732 B
JavaScript
33 lines
732 B
JavaScript
var es = require('event-stream')
|
|
, clone = require('clone')
|
|
, sass = require('node-sass')
|
|
, ext = require('gulp-util').replaceExtension
|
|
;
|
|
|
|
module.exports = function (options) {
|
|
var opts = options ? clone(options) : {};
|
|
|
|
function nodeSass (file, cb) {
|
|
// file is on object passed in by gulp
|
|
// file.contents is always a Buffer
|
|
|
|
opts.data = file.contents.toString();
|
|
|
|
opts.success = function (css) {
|
|
file.path = ext(file.path, '.css');
|
|
file.shortened = file.shortened && ext(file.shortened, '.css');
|
|
file.contents = new Buffer(css);
|
|
|
|
cb(null, file);
|
|
}
|
|
|
|
opts.error = function (err) {
|
|
cb(err);
|
|
}
|
|
|
|
sass.render(opts);
|
|
}
|
|
|
|
return es.map(nodeSass);
|
|
}
|