Answer the question
In order to leave comments, you need to log in
How to collect a source map (sourcemaps) for sass into one output file?
Hello! There are a lot of scss files, they are compiled into css files using gulp-ruby-sass, the following code generates a lot -> a lot map, that is, a lot of css files and the same number of map files.
gulp.task('sass', function () {
return sass('./source/scss/', {
compass: true,
sourcemap: true,
cacheLocation: './.sass-cache'
})
.on('error', function (err) {
console.error('Error', err.message);
})
.pipe(sourcemaps.write('../maps', {
includeContent: false,
sourceRoot: 'source'
}))
.pipe(gulp.dest('./source/css'))
.pipe(bust())
.pipe(gulp.dest('.'));
});
Answer the question
In order to leave comments, you need to log in
The answer to my question is the following: in the first task (for example, compiling sass files), we write in the task .pipe(sourcemaps.init())
, but in the following tasks, we need to initialize the maps using the loadMaps: true parameter .pipe(sourcemaps.init({loadMaps: true}))
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question