从未定义的任务:默认,要列出可用任务,请尝试运行:gulp --tasks

时间:2019-05-02 07:10:24

标签: node.js gulp browser-sync gulp-sass

运行以下代码时,出现以下错误:

[23:00:29] Task never defined: default
[23:00:29] To list available tasks, try running: gulp --tasks

gulp -v
CLI version: 2.2.0
Local version: 4.0.1

您能告诉我我在做什么错吗?

const gulp = require('gulp');
const sass = require('gulp-sass');
const browserSync = require('browser-sync').create();

//compile scss into css
function style() {
  //1. where is my sass file going to be
  return gulp.src('./scss/**/*.sass')
  //2. pass that file through sass compiler
  .pipe(sass())
  //3.Where do I save the compiled css
  .pipe(gulp.dest('./css'))
}


exports.style = style;

1 个答案:

答案 0 :(得分:0)

就像错误提示一样,您不是在定义default任务。

任何一个

  • 运行gulp style,或
  • style导出为defaultexports.default = style