Skip to content

Commit

Permalink
Remove file clone
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Will O'Brien authored and dlmanning committed Dec 15, 2013
1 parent 0f16ff1 commit a4a4348
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -31,4 +29,4 @@ module.exports = function (options) {
}

return es.map(nodeSass);
}
}

0 comments on commit a4a4348

Please sign in to comment.