Merge pull request #407 from joevbruno/filename-patch

Fixed sourcemaps filename issue ('stdin')
This commit is contained in:
Vincent Prouillet 2015-12-02 17:43:18 +00:00
commit bb90ad76ee

View file

@ -69,7 +69,8 @@ var gulpSass = function gulpSass(options, sync) {
sassMapFile,
sassFileSrc,
sassFileSrcPath,
sourceFileIndex;
sourceFileIndex,
filteredSources;
// Build Source Maps!
if (sassObj.map) {
@ -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