Excuse our dust! All other docs will be behind until we get everything updated. Please open an issue if something isn't working.
Sample gulpfile.js
This file will give you a taste of what gulp does.
var gulp = require('gulp');var less = require('gulp-less');var babel = require('gulp-babel');var concat = require('gulp-concat');var uglify = require('gulp-uglify');var rename = require('gulp-rename');var cleanCSS = require('gulp-clean-css');var del = require('del');var paths = { styles: {
Use latest JavaScript version in your gulpfile
Gulp provides a wrapper that will be loaded in your ESM code, so you can name your gulpfile as gulpfile.mjs or with "type": "module" specified in your package.json file.
And here's the same sample from above written in ESNext.
import { src, dest, watch } from 'gulp';import less from 'gulp-less';import babel from 'gulp-babel';import concat from 'gulp-concat';import uglify from 'gulp-uglify';import rename from 'gulp-rename';import cleanCSS from 'gulp-clean-css';import del from 'del';const paths = { styles: { src: 'src/styles/**/*.less', dest: 'assets/styles/' }, scripts: { src: 'src/scripts/**/*.js'
Incremental Builds
You can filter out unchanged files between runs of a task using
the gulp.src function's since option and gulp.lastRun:
Task run times are saved in memory and are lost when gulp exits. It will only
save time during the watch task when running the images task
for a second time.
Want to contribute?
Anyone can help make this project better - check out our Contributing guide!
yocontra
yo@contra.io
src: 'src/styles/**/*.less',
dest: 'assets/styles/'
},
scripts: {
src: 'src/scripts/**/*.js',
dest: 'assets/scripts/'
}
};
/* Not all tasks need to use streams, a gulpfile is just another node program
* and you can use all packages available on npm, but it must return either a
* Promise, a Stream or take a callback and call it
*/
function clean() {
// You can use multiple globbing patterns as you would with `gulp.src`,
// for example if you are using del 2.0 or above, return its promise