gulp sass不会导入与bower一起安装的引导程序
我想遍历我所有的bower包。所有将sass文件作为其主文件的文件,我希望包含在用于gulp sass的gulp sass不会导入与bower一起安装的引导程序,gulp,bower,gulp-sass,Gulp,Bower,Gulp Sass,我想遍历我所有的bower包。所有将sass文件作为其主文件的文件,我希望包含在用于gulp sass的includePaths中 我正在使用npm包main bower files成功地获取主文件(并且我只过滤到scss文件) 但是当我开始编译时,我得到了以下错误(因为现在我只有引导): 我的gulpfile的相关部分是 var load_paths = bower({ base: path.join(__dirname, "bower_components"), filter: '*
includePaths
中
我正在使用npm包main bower files
成功地获取主文件(并且我只过滤到scss文件)
但是当我开始编译时,我得到了以下错误(因为现在我只有引导):
我的gulpfile的相关部分是
var load_paths = bower({
base: path.join(__dirname, "bower_components"),
filter: '**/_*.scss'
});
gulp.src(app_css_file)
.pipe(sass({
includePaths: load_paths
}))
.pipe(concat('app.css'))
.pipe(gulp.dest('build/css'));
我的问题是,
mainbower文件
提供的是文件,而不是目录。嗯。节点sass需要包含可导入文件的目录
因此,我必须稍微修改一下我的加载路径
for (var i=0; i<load_paths.length; i++){
// we need to use the parent directories of the main files, not the files themselves
// so ./bower_components/bootstrap-sass-official/assets/stylesheets/_bootstrap.scss
// becomes ./bower_components/bootstrap-sass-official/assets/stylesheets
load_paths[i] = path.dirname(load_paths[i]);
}
(变量i=0;i)的
for (var i=0; i<load_paths.length; i++){
// we need to use the parent directories of the main files, not the files themselves
// so ./bower_components/bootstrap-sass-official/assets/stylesheets/_bootstrap.scss
// becomes ./bower_components/bootstrap-sass-official/assets/stylesheets
load_paths[i] = path.dirname(load_paths[i]);
}