Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
gulp.src('./source/js/**/*.*', {base: './source'})
.pipe(gulp.dest('./dist')) //скопирует папку js из source в dist
.pipe(gulp.dest('./deploy')); //можно использовать несколько раз
Your plugin should not do something that can be done easily with an existing node module
Wrapping every possible thing just for the sake of wrapping it will pollute the ecosystem with low quality plugins that don't make sense within the gulp paradigm.
Плагин не должен делать то, что легко делается существующим node модулем
Оборачивание всего подряд ради обертки загрязняет екосистему плагинами низкого качества, что противоречит парадигме gulp
var through2 = require('through2');
var shrthnd = require('shrthnd');
.pipe(through2.obj(function (file, enc, next) {
var contents = file.contents.toString();
var res = shrthnd(contents).string;
console.log(file.path + ": shrthnd saved " + (contents.length - res.length) + " bytes");
file.contents = new Buffer(res);
next(null, file);
}))
gulp.src([paths.src + "/app/index.styl", paths.src + "/app/vendor.styl"])
.pipe($.plumber({
errorHandler: $.notify.onError("Error: <%= error.message %>")
}))
.pipe($.sourcemaps.init())
.pipe($.stylus({
use: [nib()],
compress: true
}))
.pipe($.autoprefixer({
browsers: ['last 2 versions', 'ie 9']
}))
.pipe($.sourcemaps.write())
.pipe(gulp.dest(paths.tmp + "/serve/app/"))
var rimraf = require('rimraf');
gulp.task('clean', function(cb){
rimraf('./dist', cb);
});
Самые нужные плагины для Gulp