Remove file clone

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.
This commit is contained in:
Will O'Brien 2013-12-14 11:47:44 -05:00 committed by David Manning
parent 0f16ff1384
commit a4a43487e3

View file

@ -10,17 +10,15 @@ module.exports = function (options) {
function nodeSass (file, cb) {
// file is on object passed in by gulp
// file.contents is always a Buffer
var newFile = clone(file);
opts.data = newFile.contents.toString();
opts.data = file.contents.toString();
opts.success = function (css) {
newFile.path = ext(newFile.path, '.css');
newFile.shortened = newFile.shortened && ext(newFile.shortened, '.css');
newFile.contents = new Buffer(css);
file.path = ext(file.path, '.css');
file.shortened = file.shortened && ext(file.shortened, '.css');
file.contents = new Buffer(css);
cb(null, newFile);
cb(null, file);
}
opts.error = function (err) {
@ -31,4 +29,4 @@ module.exports = function (options) {
}
return es.map(nodeSass);
}
}