Answer the question
In order to leave comments, you need to log in
How to compress, minify and add sourcemaps in gulp?
Writing
var gulp = require('gulp')
var concat = require('gulp-concat');
var cleanCSS = require('gulp-clean-css');
var sourcemaps = require('gulp-sourcemaps');
var concatCss = require('gulp-concat-css');
gulp.task('minify-css', function() {
return gulp.src('./css/*.css')
.pipe(sourcemaps.init())
.pipe(cleanCSS())
.pipe(sourcemaps.write())
.pipe(concatCss('all.css'))
.pipe(gulp.dest('dist'));
});
Answer the question
In order to leave comments, you need to log in
I suspect that sourcemaps.write needs to be done after the concatenation so that they are generated for the final concatenated file, and not for intermediate
Yes, just rearrange it and preferably write where to unload it .pipe(sourcemaps.write('/name')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question