vladis1555
@vladis1555
Tyro

Почему не работает task gulp?

Сам task:
var gulp = require('gulp'),
		mainCSS = require('gulp-clean-css'),
		sass = require('gulp-sass'),
		browserSync = require('browser-sync').create();

gulp.task('serve', ['sass'], function() {

	browserSync.init({
		  server: "app/"
	});

	 gulp.watch("app/sass/*.sass", ['sass']);
	 gulp.watch("app/*.html").on('change', browserSync.reload);
});

gulp.task('sass', function() {
		return gulp.src("app/sass/*.sass")
				.pipe(sass())
				.pipe(gulp.dest("app/css"))
				.pipe(browserSync.stream());
});

gulp.task('default', [serve]);


package.json:

{
  "name": "myproject",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "browser-sync": "^2.24.7",
    "gulp": "^3.9.1",
    "gulp-clean-css": "^3.10.0",
    "gulp-sass": "^4.0.1"
  }
}


Ошибка в gulp:

C:\Users\Vlad\Documents\it\myproject>gulp
C:\Users\Vlad\Documents\it\myproject\gulpfile.js:23
gulp.task('default', [serve]);
^

ReferenceError: serve is not defined
at Object. (C:\Users\Vlad\Documents\it\myproject\gulpfile.js:23:23)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Liftoff.handleArguments (C:\Users\Vlad\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:116:3)
at Liftoff.execute (C:\Users\Vlad\AppData\Roaming\npm\node_modules\gulp\node_modules\liftoff\index.js:203:12)
  • Вопрос задан
  • 281 просмотр
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы