gulp-clean
    Overview
    Alternatives
    Playground
    Insights & Analysis
    Issues
    Versions
    Documentation
    Find an Expert
    Dependencies
    Career Opportunities
    Code

gulp-clean

A gulp plugin for removing files and folders.

0.4.0  •  Published 2 years ago  •  by Peter Vilja  •  MIT License

Deprecated in favor of https://github.com/gulpjs/gulp/blob/master/docs/recipes/delete-files-folder.md

gulp-clean Build Status NPM version

Removes files and folders.

Install

Install with npm.

npm install --save-dev gulp-clean

Examples

var gulp = require('gulp');
var clean = require('gulp-clean');

gulp.task('default', function () {
	return gulp.src('app/tmp', {read: false})
		.pipe(clean());
});

Option read:false prevents gulp from reading the contents of the file and makes this task a lot faster. If you need the file and its contents after cleaning in the same stream, do not set the read option to false.

var gulp = require('gulp');
var clean = require('gulp-clean');

gulp.task('default', function () {
	return gulp.src('app/tmp/index.js')
		.pipe(clean({force: true}))
		.pipe(gulp.dest('dist'));
});
For safety files and folders outside the current working directory can be removed only with option force set to true.

Clean as a dependency:

var gulp = require('gulp');
var clean = require('gulp-clean');

gulp.task('clean-scripts', function () {
  return gulp.src('app/tmp/*.js', {read: false})
    .pipe(clean());
});

gulp.task('scripts', ['clean-scripts'], function () {
  gulp.src('app/scripts/*.js')
    .pipe(gulp.dest('app/tmp'));
});

gulp.task('default', ['scripts']);

Make sure to return the stream so that gulp knows the clean task is asynchronous and waits for it to terminate before starting the dependent one.

License

MIT @ Peter Vilja

Dependencies

fancy-log  ·  plugin-error  ·  rimraf  ·  through2  ·  vinyl  ·  mocha  ·  chai

Tags

gulpplugin
clean
remove
delete
Get a weekly digest of your favorite packages
We track new versions of your favorite packages, read the changelogs, and summarize them - so you dont have to
Just $5/month per user

Popularity

Weekly Downloads
86.5K
Stars
167

Issues and PRs

Activity

Last ver 2 years ago
Created 6 years ago
Last commit 2 years ago
1 month between commits

Sustainability

10 contributors

Technology

Node version: 9.3.0
0 unpacked

Legal and Compliance

MIT License
OSI Approved
0 vulnerabilities

Top Experts

petervilja
Maintainer, 48 commits, 7 merges
bcaudan
1 commits, 1 PRs
Mathieu Bruyen
1 commits, 1 PRs
Calvin Metcalf
1 commits, 1 PRs
Works at AppGeo
Brian Koser
1 commits, 1 PRs
Peter deHaan
1 commits, 1 PRs
Works at Mozilla