Reputation: 8361
I've recently switched from Grunt to Gulp task runner.
Is it possible to output as comment the line number in the compiled CSS files that would indicate where a given rule came from in the SASS file?
Such feature was enabled by default when I was using grunt-contrib-compass module.
Now I'm using gulp-sass for compiling my sass files.
Upvotes: 4
Views: 3538
Reputation: 6543
You need to init gulp-sourcemaps
as the following:
const sourcemaps = require('gulp-sourcemaps');
function buildStyles() {
return gulp.src('./sass/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./css'));
}
exports.buildStyles = buildStyles;
then you'll get nice embedded references to your source scss:
check docs https://github.com/dlmanning/gulp-sass
Upvotes: 0
Reputation: 4318
Yes it is possible you need to pass it the right options:
.pipe(sass({
sourceComments: 'map',
sourceMap: 'sass',
outputStyle: 'nested'
}))
Upvotes: 14