what does gulp-“cli” stands for?

The goal of gulp-cli is to let you use gulp like a global program, but without installing gulp globally. For example if you installed gulp 3.9.1 globally and your project testGulp4 has gulp 4.0 installed locally, what would happen if you run gulp -v into testGulp4? Without gulp-cli globally installed : CLI version 3.9.1 In … Read more

How to set gulp.dest() in same directory as pipe inputs?

Here are two answers. First: It is longer, less flexible and needs additional modules, but it works 20% faster and gives you logs for every folder. var merge = require(‘merge-stream’); var folders = [ “./pictures/news/”, “./pictures/product/original/”, “./pictures/product/big/”, “./pictures/product/middle/”, “./pictures/product/xsmall/”, … ]; gulp.task(‘optimizeImgs’, function () { var tasks = folders.map(function (element) { return gulp.src(element + ‘*’) … Read more

How can I use the path from gulp.src() in gulp.dest()?

in your src set the base option and it will maintain the original path of your less file. gulp.task(‘compileLess’, function () { gulp.src(‘./*/less/*.less’, {base: ‘./’}) .pipe(less()) .pipe(gulp.dest( ‘./dist’ )); }); The ./dist destination can be anything. Wherever you want your file structure to be placed. Additional info here: https://github.com/wearefractal/glob-stream#options

Gulpjs combine two tasks into a single task

I think the proper way of doing this is using task dependency. In gulp you can define tasks that needs to be run before a given task. For instance: gulp.task(‘scripts’, [‘clean’], function () { // gulp.src( … }); When doing gulp scripts in the Terminal, clean is run before the scripts task. In your example … Read more

How to run a gulp task from another task?

I did it using gulp.start(); like this: gulp.task(‘test1’, function(){ gulp.start(‘test2’); }) gulp.task(‘test2′, function(){ // do something }) I was using gulp 3.9.1 if it matters. Looks like gulp.start() may be removed or deprecated; but it hasn’t happened yet. Update If I were to break things out into separate functions, as Novellizator suggested, it would be … Read more

Gulp uglify output min.js

You can use the suffix or extname parameters of gulp-rename like: gulp.task(‘compressjs’, function () { gulp.src(‘app/**/*.js’) .pipe(uglify()) .pipe(rename({ suffix: ‘.min’ })) .pipe(gulp.dest(‘dist’)) })

What is the ** glob character?

It’s almost the same as the single asterisk but may consist of multiple directory levels. In other words, while /x/*/y will match entries like: /x/a/y /x/b/y and so on (with only one directory level in the wildcard section), the double asterisk /x/**/y will also match things like: /x/any/number/of/levels/y with the concept of “any number of … Read more