I need help adding a source map to the SASS compiler in the same CSS output folder. So far, I needed to install the gulp -sourcemaps module inside gulpfile.js , but could not know the success for binding sourcemaps.write to gulp.task.
Any help is much appreciated :)
var gulp = require('gulp'); var sass = require('gulp-sass'); var sourcemaps = require('gulp-sourcemaps'); var bs = require('browser-sync').create(); gulp.task('browser-sync', ['sass'], function() { bs.init({ server: { baseDir: "./" }, proxy: { target: "localhost:8080", // can be [virtual host, sub-directory, localhost with port] ws: true // enables websockets } }); }); gulp.task('sass', function() { return gulp.src('scss/**/*.scss') .pipe(sourcemaps.init()) .pipe(sass()) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('assets/css')) .pipe(bs.reload({ stream: true })); }); gulp.task('watch', ['browser-sync'], function () { gulp.watch("scss/*.scss", ['sass']); gulp.watch("*.php").on('change', bs.reload); });
user1556571
source share