Merge pull request #314 from TrySound/fix-sourcemaps
Fixed sourcemaps with different file.base
This commit is contained in:
commit
2b0f446b9d
2
index.js
2
index.js
|
@ -74,7 +74,7 @@ var gulpSass = function gulpSass(options, sync) {
|
|||
// Grab the stdout and transform it into stdin
|
||||
sassMapFile = sassMap.file.replace('stdout', 'stdin');
|
||||
// Grab the base file name that's being worked on
|
||||
sassFileSrc = file.path.split('/').pop();
|
||||
sassFileSrc = file.relative;
|
||||
// Replace the stdin with the original file name
|
||||
sassMap.sources[sassMap.sources.indexOf(sassMapFile)] = sassFileSrc;
|
||||
// Replace the map file with the original file name (but new extension)
|
||||
|
|
22
test/main.js
22
test/main.js
|
@ -415,6 +415,28 @@ describe('gulp-sass -- sync compile', function() {
|
|||
.on('end', done);
|
||||
});
|
||||
|
||||
it('should work with gulp-sourcemaps and autoprefixer with different file.base', function(done) {
|
||||
var expectedSources = [
|
||||
'includes/_cats.scss',
|
||||
'includes/_dogs.sass',
|
||||
'scss/inheritance.scss'
|
||||
];
|
||||
|
||||
gulp.src(path.join(__dirname, '/scss/inheritance.scss'), { 'base': 'test' })
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(sass.sync())
|
||||
.pipe(tap(function(file) {
|
||||
should.exist(file.sourceMap);
|
||||
file.sourceMap.sources.should.eql(expectedSources);
|
||||
}))
|
||||
.pipe(postcss([autoprefixer()]))
|
||||
.pipe(tap(function(file) {
|
||||
should.exist(file.sourceMap);
|
||||
file.sourceMap.sources.should.eql(expectedSources);
|
||||
}))
|
||||
.on('end', done);
|
||||
});
|
||||
|
||||
it('should work with empty files', function(done) {
|
||||
gulp.src(path.join(__dirname, '/scss/empty.scss'))
|
||||
.pipe(sass.sync())
|
||||
|
|
Loading…
Reference in a new issue