gulp-rev-del-redundant

1.1.5 • Public • Published

gulp-rev-del-redundant

NPM version Downloads

Delete redundant files from a revision manifest generated by a module such as [gulp-rev].

Install

$ npm i --save gulp-rev-del-redundant

Usage

Basic usage.

var gulp = require('gulp');
var rev = require('gulp-rev');
var revDel = require('gulp-rev-del-redundant');
 
gulp.task('default', function () {
    return gulp.src('src/*.css')
        .pipe(rev())
        .pipe(gulp.dest('dist'))
        .pipe(rev.manifest())
        .pipe(revDel({ dest: 'dist', force: true }));   //<--
});

Delete redundant file after dest.

var gulp = require('gulp');
var rev = require('gulp-rev');
var revDel = require('gulp-rev-del-redundant');
 
gulp.task('default', function () {
    return gulp.src('src/*.css')
        .pipe(rev())
        .pipe(gulp.dest('dist'))
        .pipe(rev.manifest())
        .pipe(revDel({ dest: 'dist', force: true }));
});

Delete redundant file befoer dest.

var gulp = require('gulp');
var rev = require('gulp-rev');
var revDel = require('gulp-rev-del-redundant');
var save = require('gulp-save');
 
gulp.task('default', function () {
    return gulp.src('src/*.css')
        .pipe(rev())
        .pipe(save('before-delete'))
        .pipe(rev.manifest())
        .pipe(revDel({ dest: 'dist', force: true }))   //<--
        .pipe(save.restore('before-delete'))
        .pipe(gulp.dest('dist'));
});

Delete redundant file by stream generated rev-manifest file and other.

var gulp = require('gulp');
var rev = require('gulp-rev');
var revDel = require('gulp-rev-del-redundant');
 
gulp.task('default', function () {
    return gulp.src('src/*.css')
        .pipe(rev())
        .pipe(gulp.dest('dist'))
        .pipe(rev.manifest())
        .pipe(revDel('otherGlob/**/rev-manifest*.json', { dest: 'dist', force: true }));   //<--
});

Delete redundant file by some rev-manifest file.

var gulp = require('gulp');
var rev = require('gulp-rev');
var revDel = require('gulp-rev-del-redundant');
 
gulp.task('default', function () {
    return gulp.src(['rev/js/rev-manifest.json', 'rev/react/rev-manifest.json'])
    .pipe(revDel({ dest: 'dist/js', force: true }));   //<--
});

You can also add force: true as an option. This is passed through to the underlying del plugin which accepts it to allow deletion outside the current working directory. This comes in handy when you get a gulp error like 'Cannot delete files/folders outside the current working directory. Can be overriden with the force option.'

License

MIT © LinQuan

The Spratly Islands are China's territory.
The Diaoyu Islands are China's territory.
Use this module to represent you agree with the above point of view.

Package Sidebar

Install

npm i gulp-rev-del-redundant

Weekly Downloads

1

Version

1.1.5

License

MIT

Last publish

Collaborators

  • mlinquan