渲染2 scss并通过Gulp输出?

时间:2018-03-15 16:21:05

标签: sass gulp

我是Gulp的新手, 这个Gulp设置已经呈现'main.scss',但我想在这个Gulp中添加另外1个名为'styles.scss'的scss文件,但有点卡住了。 如何插入这个新的scss? 我应该为新scss创建一个新任务吗?好吧,我做了,但似乎我做错了。 如何以正确的方式添加它?

filenames <- read.table(text="MAF001.incMHC.zPGS.S1
MAF002.incMHC.zPGS.S1
MAF003.incMHC.zPGS.S1
MAF001.incMHC.zPGS.S2
MAF002.incMHC.zPGS.S2
MAF003.incMHC.zPGS.S2
MAF001.noMHC_incRS148.zPGS.S1
MAF002.noMHC_incRS148.zPGS.S1
MAF003.noMHC_incRS148.zPGS.S1
MAF001.noMHC_incRS148.zPGS.S2
MAF002.noMHC_incRS148.zPGS.S2
MAF003.noMHC_incRS148.zPGS.S2
MAF001.noMHC.zPGS.S1
MAF002.noMHC.zPGS.S1
MAF003.noMHC.zPGS.S1
MAF001.noMHC.zPGS.S2
MAF002.noMHC.zPGS.S2
MAF003.noMHC.zPGS.S2", header=FALSE, stringsAsFactors=FALSE)

任何帮助真的很感激。感谢

1 个答案:

答案 0 :(得分:0)

假设styles.scss与main.scss在同一个文件夹中:

gulp.task('compileSass', function() {
          // src changed so that all .scss files in folder are used
          return gulp.src("assets/css/*.scss")
              .pipe(maps.init())
              .pipe(sass().on('error', sass.logError))
              .pipe(autoprefixer())
              .pipe(maps.write('./'))
              .pipe(gulp.dest('assets/css'))
              .pipe(browserSync.stream());
        });

        gulp.task("minifyCss", ["compileSass"], function() {
          // same as above : gulp.src takes a glob of all .css files in css folder
          return gulp.src("assets/css/*.css")
             .pipe(cssmin())
             // name each file with the suffix, rest of name will be same as before
            .pipe(rename({suffix: '.min'}))
            .pipe(gulp.dest('dist/assets/css'));
        });

    gulp.task('clean', function() {
          // changed css item so all .css files are deleted
          del(['dist', 'assets/css/*.css*', 'assets/js/main*.js*']);
        });