问题
I'm using the gulp-sass and would like for each partials he manages a sourcemap , I can do this using the less but did not see a way to do this with sass.
_partial.scss ( within it have to have a mapfile ).
_partial2.scss ( this also ).
回答1:
According the specification from sass-lang files starting with a _
are not compilled. See also: https://github.com/sass/node-sass/issues/215
So rename your partials with gulp-rename:
var sourcemaps = require('gulp-sourcemaps');
var gulp = require('gulp');
var sass = require('gulp-sass');
var rename = require("gulp-rename");
gulp.task('sass', function () {
gulp.src('./scss/*.scss')
.pipe(sourcemaps.init())
.pipe(rename(function (path) {
path.basename = path.basename.replace(/^_/,'');
}))
.pipe(sass())
.pipe(sourcemaps.write())
.pipe(gulp.dest('./css'));
});
来源:https://stackoverflow.com/questions/29635384/generate-sourcemap-for-each-partial