【发布时间】:2017-11-03 02:00:06
【问题描述】:
我有一个按组件组织的 SCSS 部分列表,我尝试使用 Gulp 单独编译这些组件,但不知道该怎么做。
这是我要编译的部分文件列表:
_header.scss
_button.scss
_navigation.scss
我想将这些文件输出到与
相同的目录中header.css
button.css
navigation.css
我正在使用gulp-sass 将我的所有 SCSS 文件编译成一个文件,如下所示:
gulp.task('styles', function() {
return gulp
// Find all `.scss` files from the `stylesheets/` folder
.src('./src/stylesheets/**/*.scss')
// Run Sass on those files
.pipe(sass({
style: 'expanded',
}).on('error', sass.logError))
// Write the resulting CSS in the output folder
.pipe(gulp.dest('build/stylesheets'))
});
有没有办法创建一个单独的 Gulp 任务来单独编译和输出目录中的每个文件,而不是最后将它们组合成一个文件?
提前致谢。
【问题讨论】: