0.0.1 • Published 6 years ago
gulp-cache-release v0.0.1
Information
Installation
yarn add gulp-cache-release --dev
or
npm install --save-dev gulp-cache-release
Usage
This keeps an in-memory cache of files (and their contents) that have passed through it. If a file has already passed through on the last run it will only be passed downstream if/when release
is called. This means you only process what you need and save time + resources. If release
is not called, it will work exactly like gulp-cached
Take this example:
const gulp = require('gulp');
const { cache, release } = require('gulp-cached');
const uglify = require('gulp-uglify')
const concat = require('gulp-concat')
gulp.task('bundle', () => {
return gulp.src('src/*')
.pipe(cache('src'))
.pipe(uglify())
.pipe(release('src'))
.pipe(concat('bundle.js'))
.pipe(gulp.dest('dist'))
})
gulp.task('watch' ,() => {
return gulp.watch('src/*', ['bundle'])
})
gulp.task('default', ['watch', 'bundle'])
- User saves
files/a.js
and thebundle
task is calledbundle
task has never been called before- all files in
src
are uglified and concatenated
- User saves
src/b.js
and thebundle
task is called- the contents of the file changed from the previous value
files/b.js
is uglified, but all files are concatenated
- User saves
files/a.js
and thebundle
task is called- the contents of the file have not changed from the previous value
- nothing is bundled
cache(cacheName, opt)
Please read the instructions here gulp-cached
release(cacheName)
Releases all cached files at that point downstream on second run. On first run it caches all files and passes it downstream.
0.0.1
6 years ago