При запуске команды
В терминале такая шляпа
$ gulp
[01:09:44] Using gulpfile ~/Sites/testing1/gulpfile.js
[01:09:44] Starting 'html:build'...
[01:09:44] Finished 'html:build' after 8.22 ms
[01:09:44] Starting 'js:build'...
[01:09:44] Finished 'js:build' after 6.63 ms
[01:09:44] Starting 'style:build'...
[01:09:44] Finished 'style:build' after 12 ms
[01:09:44] Starting 'fonts:build'...
[01:09:44] Finished 'fonts:build' after 1.08 ms
[01:09:44] Starting 'image:build'...
[01:09:44] Finished 'image:build' after 3.85 ms
[01:09:44] Starting 'build'...
[01:09:44] Finished 'build' after 3.32 μs
[01:09:44] Starting 'webserver'...
[01:09:44] Finished 'webserver' after 128 ms
[01:09:44] Starting 'watch'...
[01:09:44] Finished 'watch' after 12 ms
[01:09:44] Starting 'default'...
[01:09:44] Finished 'default' after 4.71 μs
[01:09:44] gulp-imagemin: Minified 0 images
buffer.js:67
throw new TypeError('must start with number, buffer, array or string');
^
TypeError: must start with number, buffer, array or string
at new Buffer (buffer.js:67:11)
at /Users/Aleksandr/Sites/testing1/node_modules/gulp-rigger/index.js:20:29
at Rigger.<anonymous> (/Users/Aleksandr/Sites/testing1/node_modules/gulp-rigger/node_modules/rigger/index.js:719:9)
at Rigger.emit (events.js:107:17)
at /Users/Aleksandr/Sites/testing1/node_modules/gulp-rigger/node_modules/rigger/index.js:252:16
at /Users/Aleksandr/Sites/testing1/node_modules/gulp-rigger/node_modules/rigger/node_modules/async/lib/async.js:232:13
at /Users/Aleksandr/Sites/testing1/node_modules/gulp-rigger/node_modules/rigger/node_modules/async/lib/async.js:113:21
at /Users/Aleksandr/Sites/testing1/node_modules/gulp-rigger/node_modules/rigger/node_modules/async/lib/async.js:24:16
at /Users/Aleksandr/Sites/testing1/node_modules/gulp-rigger/node_modules/rigger/node_modules/async/lib/async.js:229:17
at /Users/Aleksandr/Sites/testing1/node_modules/gulp-rigger/node_modules/rigger/index.js:391:21
Вот сам файл gulpfile.js
'use strict';
var gulp = require('gulp'),
watch = require('gulp-watch'),
prefixer = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
rigger = require('gulp-rigger'),
cssmin = require('gulp-minify-css'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant'),
rimraf = require('rimraf'),
browserSync = require("browser-sync"),
reload = browserSync.reload;
var path = {
build: {
html: 'build/',
js: 'build/js/',
css: 'build/css/',
img: 'build/img/',
fonts: 'build/fonts/'
},
src: {
html: 'src/*.html',
js: 'src/js/main.js',
style: 'src/style/main.scss',
img: 'src/img/**/*.*',
fonts: 'src/fonts/**/*.*'
},
watch: {
html: 'src/**/*.html',
js: 'src/js/**/*.js',
style: 'src/style/**/*.scss',
img: 'src/img/**/*.*',
fonts: 'src/fonts/**/*.*'
},
clean: './build'
};
var config = {
server: {
baseDir: "./build"
},
tunnel: true,
host: 'localhost',
port: 9000,
logPrefix: "Frontend_Devil"
};
gulp.task('webserver', function () {
browserSync(config);
});
gulp.task('clean', function (cb) {
rimraf(path.clean, cb);
});
gulp.task('html:build', function () {
gulp.src(path.src.html)
.pipe(rigger())
.pipe(gulp.dest(path.build.html))
.pipe(reload({stream: true}));
});
gulp.task('js:build', function () {
gulp.src(path.src.js)
.pipe(rigger())
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest(path.build.js))
.pipe(reload({stream: true}));
});
gulp.task('style:build', function () {
gulp.src(path.src.style)
.pipe(sourcemaps.init())
.pipe(sass({
includePaths: ['src/style/'],
outputStyle: 'compressed',
sourceMap: true,
errLogToConsole: true
}))
.pipe(prefixer())
.pipe(cssmin())
.pipe(sourcemaps.write())
.pipe(gulp.dest(path.build.css))
.pipe(reload({stream: true}));
});
gulp.task('image:build', function () {
gulp.src(path.src.img)
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()],
interlaced: true
}))
.pipe(gulp.dest(path.build.img))
.pipe(reload({stream: true}));
});
gulp.task('fonts:build', function() {
gulp.src(path.src.fonts)
.pipe(gulp.dest(path.build.fonts))
});
gulp.task('build', [
'html:build',
'js:build',
'style:build',
'fonts:build',
'image:build'
]);
gulp.task('watch', function(){
watch([path.watch.html], function(event, cb) {
gulp.start('html:build');
});
watch([path.watch.style], function(event, cb) {
gulp.start('style:build');
});
watch([path.watch.js], function(event, cb) {
gulp.start('js:build');
});
watch([path.watch.img], function(event, cb) {
gulp.start('image:build');
});
watch([path.watch.fonts], function(event, cb) {
gulp.start('fonts:build');
});
});
gulp.task('default', ['build', 'webserver', 'watch']);
Делал точь в точь как
тут