# gulp-clean

> A gulp plugin for removing files and folders.

Latest version **0.4.0** (published 2018-01-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-clean
pnpm add gulp-clean
yarn add gulp-clean
bun add gulp-clean
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2018-01-10 |
| First published | 2013-12-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.9 |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 178 |
| Author | Peter Vilja |
| Maintainers | petervilja |
| Keywords | gulpplugin, clean, remove, delete |

## Links

- npm: https://www.npmjs.com/package/gulp-clean
- Repository: https://github.com/peter-vilja/gulp-clean
- Issues: https://github.com/peter-vilja/gulp-clean/issues
- npm.io page: https://npm.io/package/gulp-clean

## Dependencies (5)

- [vinyl](https://npm.io/package/vinyl.md) ^2.1.0
- [rimraf](https://npm.io/package/rimraf.md) ^2.6.2
- [through2](https://npm.io/package/through2.md) ^2.0.3
- [fancy-log](https://npm.io/package/fancy-log.md) ^1.3.2
- [plugin-error](https://npm.io/package/plugin-error.md) ^0.1.2

## Recent versions

- 0.4.0 (latest) — 2018-01-10
- 0.3.2 — 2016-03-03
- 0.3.1 — 2014-06-25
- 0.3.0 — 2014-05-25
- 0.2.4 — 2014-01-19
- 0.2.3 — 2014-01-16
- 0.2.2 — 2014-01-08
- 0.2.1 — 2014-01-08
- 0.2.0 — 2014-01-07
- 0.1.3 — 2014-01-01
- 0.1.2 — 2013-12-24
- 0.1.1 — 2013-12-23

## README

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

# [gulp](https://github.com/wearefractal/gulp)-clean [![Build Status](https://secure.travis-ci.org/peter-vilja/gulp-clean.png?branch=master)](https://travis-ci.org/peter-vilja/gulp-clean) [![NPM version](https://badge.fury.io/js/gulp-clean.png)](http://badge.fury.io/js/gulp-clean)

> Removes files and folders.

## Install

Install with [npm](https://npmjs.org/package/gulp-clean).

```
npm install --save-dev gulp-clean
```

## Examples

```js
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.

```js
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:

```js
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](https://github.com/gulpjs/gulp/blob/master/docs/API.md#async-task-support) and waits for it to terminate before starting the dependent one.

## License

[MIT](http://en.wikipedia.org/wiki/MIT_License) @ Peter Vilja

---
_Source: https://npm.io/package/gulp-clean · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
