如何正确配置gulp-sass?

时间:2015-09-27 23:55:11

标签: sass libsass

这是我的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出了什么问题。任何帮助将非常感激。

0 个答案:

没有答案