在自己为此苦苦挣扎之后,我在 gulp-sass 中找到了一个选项:
sass({ includePaths: ['./bower_components/bootstrap-sass/assets/stylesheets']})
例子:
var gulp = require('gulp'),
sass = require('gulp-sass')
notify = require("gulp-notify");
var config = {
sassPath: './resources/sass', // store the sass files I create
bowerDir: './bower_components'
}
gulp.task('css', function() {
return gulp.src(config.sassPath + '/style.scss')
.pipe(sass({
outputStyle: 'compressed',
includePaths: [
'./resources/sass',
config.bowerDir + '/bootstrap-sass/assets/stylesheets',
config.bowerDir + '/font-awesome/scss']
})
.on("error", notify.onError(function (error) {
return "Error: " + error.message;
})))
.pipe(gulp.dest('./public/css'));
});