You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
3.0 KiB

  1. # grunt-contrib-clean [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-clean.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-clean)
  2. > Clean files and folders.
  3. ## Getting Started
  4. This plugin requires Grunt `~0.4.0`
  5. 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:
  6. ```shell
  7. npm install grunt-contrib-clean --save-dev
  8. ```
  9. Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
  10. ```js
  11. grunt.loadNpmTasks('grunt-contrib-clean');
  12. ```
  13. *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).*
  14. ## Clean task
  15. _Run this task with the `grunt clean` command._
  16. Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
  17. *Due to the destructive nature of this task, always be cautious of the paths you clean.*
  18. ### Options
  19. #### force
  20. Type: `Boolean`
  21. Default: false
  22. This overrides `grunt.file.delete` from blocking deletion of folders outside current working dir (CWD). Use with caution.
  23. ### Usage Examples
  24. There are three formats you can use to run this task.
  25. #### Short
  26. ```js
  27. clean: ["path/to/dir/one", "path/to/dir/two"]
  28. ```
  29. #### Medium (specific targets with global options)
  30. ```js
  31. clean: {
  32. build: ["path/to/dir/one", "path/to/dir/two"],
  33. release: ["path/to/another/dir/one", "path/to/another/dir/two"]
  34. },
  35. ```
  36. #### Long (specific targets with per target options)
  37. ```js
  38. clean: {
  39. build: {
  40. src: ["path/to/dir/one", "path/to/dir/two"]
  41. }
  42. }
  43. ```
  44. ## Release History
  45. * 2013-04-16   v0.4.1   Check if file exists to avoid trying to delete a non-existent file.
  46. * 2013-02-15   v0.4.0   First official release for Grunt 0.4.0.
  47. * 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.
  48. * 2013-01-09   v0.4.0rc5   Updating to work with grunt v0.4.0rc5. Switching to this.filesSrc api.
  49. * 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.
  50. * 2012-09-23   v0.3.0   Options no longer accepted from global config key.
  51. * 2012-09-10   v0.2.0   Refactored from grunt-contrib into individual repo.
  52. ---
  53. Task submitted by [Tim Branyen](http://tbranyen.com/)
  54. *This file was generated on Tue Apr 16 2013 13:28:15.*