Commit 8b64a1d8 authored by Nikolay Gromov's avatar Nikolay Gromov

Добавил plumber

parent b41b3073
...@@ -11,6 +11,7 @@ const autoprefixer = require("autoprefixer") ...@@ -11,6 +11,7 @@ const autoprefixer = require("autoprefixer")
const mqpacker = require("css-mqpacker") const mqpacker = require("css-mqpacker")
const cleanss = require('gulp-cleancss'); const cleanss = require('gulp-cleancss');
const plumber = require('gulp-plumber');
const notify = require('gulp-notify'); const notify = require('gulp-notify');
const gulpIf = require('gulp-if'); const gulpIf = require('gulp-if');
const debug = require('gulp-debug'); const debug = require('gulp-debug');
...@@ -60,16 +61,19 @@ gulp.task('style', function () { ...@@ -60,16 +61,19 @@ gulp.task('style', function () {
const sourcemaps = require('gulp-sourcemaps'); const sourcemaps = require('gulp-sourcemaps');
console.log('---------- Компиляция стилей'); console.log('---------- Компиляция стилей');
return gulp.src(dirs.srcPath + 'scss/style.scss') return gulp.src(dirs.srcPath + 'scss/style.scss')
.pipe(gulpIf(isDev, sourcemaps.init())) .pipe(plumber({
.pipe(debug({title: "Style:"})) errorHandler: function(err) {
.pipe(sass()) notify.onError({
.pipe(postcss(postCssPlugins))
.on('error', notify.onError(function(err){
return {
title: 'Styles compilation error', title: 'Styles compilation error',
message: err.message message: err.message
})(err);
this.emit('end');
} }
})) }))
.pipe(gulpIf(isDev, sourcemaps.init()))
.pipe(debug({title: "Style:"}))
.pipe(sass())
.pipe(postcss(postCssPlugins))
.pipe(gulpIf(!isDev, cleanss())) .pipe(gulpIf(!isDev, cleanss()))
.pipe(rename('style.min.css')) .pipe(rename('style.min.css'))
.pipe(gulpIf(isDev, sourcemaps.write('/'))) .pipe(gulpIf(isDev, sourcemaps.write('/')))
...@@ -192,14 +196,17 @@ gulp.task('js', function (callback) { ...@@ -192,14 +196,17 @@ gulp.task('js', function (callback) {
if(lists.js.length > 0){ if(lists.js.length > 0){
console.log('---------- Обработка JS'); console.log('---------- Обработка JS');
return gulp.src(lists.js) return gulp.src(lists.js)
.pipe(concat('script.min.js')) .pipe(plumber({
.pipe(gulpIf(!isDev, uglify())) errorHandler: function(err) {
.on('error', notify.onError(function(err){ notify.onError({
return { title: 'Javascript concat/uglify error',
title: 'Javascript uglify error',
message: err.message message: err.message
})(err);
this.emit('end');
} }
})) }))
.pipe(concat('script.min.js'))
.pipe(gulpIf(!isDev, uglify()))
.pipe(size({ .pipe(size({
title: 'Размер', title: 'Размер',
showFiles: true, showFiles: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment