1

这是我的 gulpfile。

var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var babel = require("gulp-babel");

// Gulp Sass Task
gulp.task('sass', function () {
    console.log('called');
  // gulp.src locates the source files for the process.
  // This globbing function tells gulp to use all files
  // ending with .scss or .sass within the scss folder.
  gulp.src("scss/*.scss")
    // Converts Sass into CSS with Gulp Sass
    .pipe(sass().on('error', sass.logError))
    // Outputs CSS files in the css folder
    .pipe(gulp.dest("css"));
});

// Watch scss folder for changes
gulp.task('watch', function() {
  // Watches the scss folder for all .scss and .sass files
  // If any file changes, run the sass task
  gulp.watch('./scss/**/*.{scss,sass}', ['sass'])
});

gulp.task("transpile", function () {
  return gulp.src("js/*.js")
    .pipe(babel())
    .pipe(gulp.dest("./compile"));
});

// Creating a default task
gulp.task('build', ['sass', 'transpile']);

gulp sass 成功运行,但没有创建我期望的任何 css 文件夹。另外,当我手动运行 sass 时,

sass --trace  _picker.scss:css/_picker.css

我看到 css 正在正确编译。不确定 gulpfile 出了什么问题。任何帮助将非常感激。

4

0 回答 0