[484] | 1 | # grunt-contrib-clean [](https://travis-ci.org/gruntjs/grunt-contrib-clean) |
---|
| 2 | |
---|
| 3 | > Clean files and folders. |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | ## Getting Started |
---|
| 8 | This plugin requires Grunt `~0.4.0` |
---|
| 9 | |
---|
| 10 | If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: |
---|
| 11 | |
---|
| 12 | ```shell |
---|
| 13 | npm install grunt-contrib-clean --save-dev |
---|
| 14 | ``` |
---|
| 15 | |
---|
| 16 | Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: |
---|
| 17 | |
---|
| 18 | ```js |
---|
| 19 | grunt.loadNpmTasks('grunt-contrib-clean'); |
---|
| 20 | ``` |
---|
| 21 | |
---|
| 22 | *This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that [you upgrade](http://gruntjs.com/upgrading-from-0.3-to-0.4), but in case you can't please use [v0.3.2](https://github.com/gruntjs/grunt-contrib-clean/tree/grunt-0.3-stable).* |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | ## Clean task |
---|
| 27 | _Run this task with the `grunt clean` command._ |
---|
| 28 | |
---|
| 29 | Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide. |
---|
| 30 | |
---|
| 31 | *Due to the destructive nature of this task, always be cautious of the paths you clean.* |
---|
| 32 | ### Options |
---|
| 33 | |
---|
| 34 | #### force |
---|
| 35 | Type: `Boolean` |
---|
| 36 | Default: false |
---|
| 37 | |
---|
| 38 | This overrides this task from blocking deletion of folders outside current working dir (CWD). Use with caution. |
---|
| 39 | |
---|
| 40 | #### no-write |
---|
| 41 | Type: `Boolean` |
---|
| 42 | Default: false |
---|
| 43 | |
---|
| 44 | Will log messages of what would happen if the task was ran but doesn't actually delete the files. |
---|
| 45 | |
---|
| 46 | ### Usage Examples |
---|
| 47 | |
---|
| 48 | There are three formats you can use to run this task. |
---|
| 49 | |
---|
| 50 | #### Short |
---|
| 51 | |
---|
| 52 | ```js |
---|
| 53 | clean: ["path/to/dir/one", "path/to/dir/two"] |
---|
| 54 | ``` |
---|
| 55 | |
---|
| 56 | #### Medium (specific targets with global options) |
---|
| 57 | |
---|
| 58 | ```js |
---|
| 59 | clean: { |
---|
| 60 | build: ["path/to/dir/one", "path/to/dir/two"], |
---|
| 61 | release: ["path/to/another/dir/one", "path/to/another/dir/two"] |
---|
| 62 | }, |
---|
| 63 | ``` |
---|
| 64 | |
---|
| 65 | #### Long (specific targets with per target options) |
---|
| 66 | |
---|
| 67 | ```js |
---|
| 68 | clean: { |
---|
| 69 | build: { |
---|
| 70 | src: ["path/to/dir/one", "path/to/dir/two"] |
---|
| 71 | } |
---|
| 72 | } |
---|
| 73 | ``` |
---|
| 74 | |
---|
| 75 | ## Release History |
---|
| 76 | |
---|
| 77 | * 2013-07-15âââv0.5.0âââUse rimraf directly, version 2.2.1 to fix issue on Windows. Add no-write option to mimic grunt.file.delete behavior. |
---|
| 78 | * 2013-04-16âââv0.4.1âââCheck if file exists to avoid trying to delete a non-existent file. |
---|
| 79 | * 2013-02-15âââv0.4.0âââFirst official release for Grunt 0.4.0. |
---|
| 80 | * 2013-01-18âââv0.4.0rc6âââUpdating grunt/gruntplugin dependencies to rc6. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions. |
---|
| 81 | * 2013-01-09âââv0.4.0rc5âââUpdating to work with grunt v0.4.0rc5. Switching to this.filesSrc api. |
---|
| 82 | * 2012-12-07âââv0.4.0aâââConversion to grunt v0.4 conventions. Remove node v0.6 and grunt v0.3 support. Add force option to bypass CWD check. |
---|
| 83 | * 2012-09-23âââv0.3.0âââOptions no longer accepted from global config key. |
---|
| 84 | * 2012-09-10âââv0.2.0âââRefactored from grunt-contrib into individual repo. |
---|
| 85 | |
---|
| 86 | --- |
---|
| 87 | |
---|
| 88 | Task submitted by [Tim Branyen](http://tbranyen.com/) |
---|
| 89 | |
---|
| 90 | *This file was generated on Mon Jul 15 2013 20:45:46.* |
---|