Skip to content

Commit

Permalink
Merge pull request #407 from joevbruno/filename-patch
Browse files Browse the repository at this point in the history
Fixed sourcemaps filename issue ('stdin')
  • Loading branch information
Keats committed Dec 2, 2015
2 parents 5787925 + 4e51591 commit bb90ad7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ var gulpSass = function gulpSass(options, sync) {
sassMapFile,
sassFileSrc,
sassFileSrcPath,
sourceFileIndex;
sourceFileIndex,
filteredSources;

// Build Source Maps!
if (sassObj.map) {
Expand All @@ -89,8 +90,14 @@ var gulpSass = function gulpSass(options, sync) {
}
}
}
// Replace the stdin with the original file name
sassMap.sources[sassMap.sources.indexOf(sassMapFile)] = sassFileSrc;
// Remove 'stdin' from souces and replace with filenames!
filteredSources = sassMap.sources.filter(function(src) {
if (src.indexOf('stdin') === -1) {
return src;
}
});
sassMap.sources = filteredSources;
sassMap.sources.unshift(sassFileSrc);
// Replace the map file with the original file name (but new extension)
sassMap.file = gutil.replaceExtension(sassFileSrc, '.css');
// Apply the map
Expand Down

0 comments on commit bb90ad7

Please sign in to comment.