Перестал запускаться gulp после ручной перезагрузки страницы, не знаю, может это как то связано. Выдает вот такую ошибку
C:\dv7\_html>gulp
Using gulpfile C:\dv7\_html\gulpfile.js
Starting 'sass'...
Starting 'common-js'...
Starting 'browser-sync'...
Finished 'browser-sync' after 84 ms
events.js:182
throw er; // Unhandled 'error' event
^
GulpUglifyError: unable to minify JavaScript
at createError (C:\dv7\_html\node_modules\gulp-uglify\lib\create-error.js:6:14)
at apply (C:\dv7\_html\node_modules\gulp-uglify\node_modules\lodash\_apply.js:16:25)
at wrapper (C:\dv7\_html\node_modules\gulp-uglify\node_modules\lodash\_createCurry.js:41:12)
at C:\dv7\_html\node_modules\gulp-uglify\lib\minify.js:54:15
at DestroyableTransform._transform (C:\dv7\_html\node_modules\gulp-uglify\composer.js:10:23)
at DestroyableTransform.Transform._read (C:\dv7\_html\node_modules\readable-stream\lib\_stream_transform.js:182:10)
at DestroyableTransform.Transform._write (C:\dv7\_html\node_modules\readable-stream\lib\_stream_transform.js:170:83)
at doWrite (C:\dv7\_html\node_modules\readable-stream\lib\_stream_writable.js:406:64)
at writeOrBuffer (C:\dv7\_html\node_modules\readable-stream\lib\_stream_writable.js:395:5)
at DestroyableTransform.Writable.write (C:\dv7\_html\node_modules\readable-stream\lib\_stream_writable.js:322:11)
at DestroyableTransform.ondata (C:\dv7\_html\node_modules\readable-stream\lib\_stream_readable.js:612:20)
at emitOne (events.js:115:13)
at DestroyableTransform.emit (events.js:210:7)
at addChunk (C:\dv7\_html\node_modules\readable-stream\lib\_stream_readable.js:284:12)
at readableAddChunk (C:\dv7\_html\node_modules\readable-stream\lib\_stream_readable.js:271:11)
at DestroyableTransform.Readable.push (C:\dv7\_html\node_modules\readable-stream\lib\_stream_readable.js:238:10)
C:\dv7\_html>
gulpfile.js
var gulp = require('gulp'),
gutil = require('gulp-util' ),
sass = require('gulp-sass'),
browserSync = require('browser-sync'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
cleanCSS = require('gulp-clean-css'),
rename = require('gulp-rename'),
del = require('del'),
imagemin = require('gulp-imagemin'),
cache = require('gulp-cache'),
autoprefixer = require('gulp-autoprefixer'),
ftp = require('vinyl-ftp'),
notify = require("gulp-notify"),
rsync = require('gulp-rsync');
gulp.task('common-js', function() {
return gulp.src([
'app/js/common.js',
])
.pipe(concat('common.min.js'))
.pipe(uglify())
.pipe(gulp.dest('app/js'));
});
gulp.task('js', ['common-js'], function() {
return gulp.src([
'app/libs/jquery/dist/jquery.min.js',
'app/libs/mmenu/js/jquery.mmenu.all.min.js',
'app/libs/owl.carousel/owl.carousel.min.js',
'app/js/common.min.js', // Всегда в конце
])
.pipe(concat('scripts.min.js'))
.pipe(gulp.dest('app/js'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: 'app'
},
notify: false,
});
});
gulp.task('sass', function() {
return gulp.src('app/sass/**/*.sass')
.pipe(sass({outputStyle: 'expand'}).on("error", notify.onError()))
.pipe(rename({suffix: '.min', prefix : ''}))
.pipe(autoprefixer(['last 15 versions']))
.pipe(cleanCSS())
.pipe(gulp.dest('app/css'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task('watch', ['sass', 'js', 'browser-sync'], function() {
gulp.watch('app/sass/**/*.sass', ['sass']);
gulp.watch(['libs/**/*.js', 'app/js/common.js'], ['js']);
gulp.watch('app/*.html', browserSync.reload);
});
gulp.task('imagemin', function() {
return gulp.src('app/img/**/*')
.pipe(cache(imagemin()))
.pipe(gulp.dest('dist/img'));
});
gulp.task('build', ['removedist', 'imagemin', 'sass', 'js'], function() {
var buildFiles = gulp.src([
'app/*.html',
'app/.htaccess',
]).pipe(gulp.dest('dist'));
var buildCss = gulp.src([
'app/css/main.min.css',
]).pipe(gulp.dest('dist/css'));
var buildJs = gulp.src([
'app/js/scripts.min.js',
]).pipe(gulp.dest('dist/js'));
var buildFonts = gulp.src([
'app/fonts/**/*',
]).pipe(gulp.dest('dist/fonts'));
});
gulp.task('deploy', function() {
var conn = ftp.create({
host: 'hostname.com',
user: 'username',
password: 'userpassword',
parallel: 10,
log: gutil.log
});
var globs = [
'dist/**',
'dist/.htaccess',
];
return gulp.src(globs, {buffer: false})
.pipe(conn.dest('/path/to/folder/on/server'));
});
gulp.task('rsync', function() {
return gulp.src('dist/**')
.pipe(rsync({
root: 'dist/',
hostname: 'username@yousite.com',
destination: 'yousite/public_html/',
archive: true,
silent: false,
compress: true
}));
});
gulp.task('removedist', function() { return del.sync('dist'); });
gulp.task('clearcache', function () { return cache.clearAll(); });
gulp.task('default', ['watch']);