Задать вопрос
@shadowcat

Did you forget to signal async completion?

Ошибка при вводе gulp build

The following tasks did not complete: build, clean
Did you forget to signal async completion?


gulp local version 4.0.0
gulp CLI version 2.0.1
node version 10.5.0

gulpfile.js

var gulp = require('gulp'),
	sass = require('gulp-sass'),
	browserSync = require('browser-sync'),
	concat = require('gulp-concat'),
	uglify = require('gulp-uglifyjs'),
	cssnano = require('gulp-cssnano'),
	rename = require('gulp-rename'),
	del = require('del'),
	imagemin = require('gulp-imagemin'),
	pngquant = require('imagemin-pngquant'),
	cache = require('gulp-cache'),
	autoprefixer = require('gulp-autoprefixer');

gulp.task('sass', function(){
	return gulp.src('app/sass/*.sass')
	.pipe(sass())
	.pipe(autoprefixer(['last 7 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true}))
	.pipe(gulp.dest('app/css'))
	.pipe(browserSync.reload({stream: true}))
});


gulp.task('scripts', function(){
	return gulp.src([
		'app/libs/bootstrap-3.3.7-dist/js/bootstrap.min.js'
	])
	.pipe(concat('libs.min.js'))
	.pipe(uglify())
	.pipe(gulp.dest('app/js'));
});

gulp.task('css-libs', gulp.parallel('sass'), function(){
	return gulp.src('app/css/libs.css')
	.pipe(cssnano())
	.pipe(rename({suffix: '.min'}))
	.pipe(gulp.dest('app/css'));
});

/*gulp.task('browser-sync', function(){
	browserSync({
		server: { 
            baseDir: 'app' 
        },
        notify: false 
	});
});*/
gulp.task('browser-sync', gulp.parallel('sass', 'scripts'), function() {
    browserSync.init({
        proxy: "vitis",
        notify: false
    });
});

gulp.task('clean', function(){
	return del.sync([
	    'www/web/css',
	    'www/web/img',
	    'www/web/js'
    ]);
});

gulp.task('clear', function(){
	return cache.clearAll();
});

gulp.task('img', function(){
	return gulp.src('app/img/**/*')
	.pipe(cache(imagemin({
		interlaced: true,
		progressive: true,
		svgoPlugins: [{removeViewBox: false}],
		use: [pngquant()]
	})))
	.pipe(gulp.dest('www/web/img'));
});

gulp.task('watch', gulp.parallel('browser-sync', 'scripts'), function(){
	gulp.watch('app/sass/*.sass', ['sass']);
	gulp.watch('app/*.html', browserSync.reload);
	gulp.watch('www/views/*.php', browserSync.reload);
	gulp.watch('app/js/*.js', browserSync.reload);
});

gulp.task('build', gulp.parallel('clean', 'img', 'sass', 'scripts'), function(){
	var buildCss = gulp.src([
		'app/css/main.css',
		'app/css/libs.min.css',
	])
		.pipe(gulp.dest('www/web/css'));

	var buildFonts = gulp.src('app/fonts/**/*')
		.pipe(gulp.dest('www/web/fonts'));

	var buildJs = gulp.src('app/js/**/*')
		.pipe(gulp.dest('www/web/js'));

	var buildHtml = gulp.src('app/*.html')
		.pipe(gulp.dest('www/views/html'));

});

//gulp.task('default', ['build', 'browser-sync']);

gulp.task('default', gulp.parallel('browser-sync', 'watch'));
  • Вопрос задан
  • 5092 просмотра
Подписаться 2 Простой 1 комментарий
Пригласить эксперта
Ваш ответ на вопрос

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

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