Skip to content

Commit

Permalink
Update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
fatfisz committed Apr 26, 2016
1 parent 95a8743 commit 112189b
Showing 1 changed file with 35 additions and 60 deletions.
95 changes: 35 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,97 +2,72 @@

> Touch files
wraps [node-touch](https://github.com/isaacs/node-touch) as a grunt multi-task.
A grunt wrapper for [node-touch](https://github.com/isaacs/node-touch).

## Getting Started
This plugin requires Grunt `~0.4.1`

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:
## Install

```shell
npm install grunt-touch --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
## Usage

```js
grunt.loadNpmTasks('grunt-touch');

grunt.initConfig({
touch: {
target: ['file.js'],
},
});
```

## The "touch" task
## Examples

### Overview
In your project's Gruntfile, add a section named `touch` to the data object passed into `grunt.initConfig()`.
### Match existing files

```js
grunt.loadNpmTasks('grunt-touch');

grunt.initConfig({
touch: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
match: true,
},
target: ['match_*.js'],
},
})
```

### Options

Options align with https://github.com/isaacs/node-touch#options

#### options.force
Type: `Boolean`
Default value: `false`

like `touch -f`

#### options.time
Type: `Date`
Default value: `new Date()`
});

like `touch -t <date>` where `<date>` is a Date, parsable Date string or epoch ms numbder
### Custom date

#### options.atime
Type: `Date`
Default value: `null`
```js
grunt.loadNpmTasks('grunt-touch');
like `touch -a`, value may be a Boolean or a Date
grunt.initConfig({
touch: {
options: {
time: Date.now() + 5000, // Set time to 5 seconds in the future
},
target: ['file.js'],
},
});
#### options.mtime
Type: `Date`
Default value: `null`
like `touch -m`, value may be a Boolean or a Date
## Options
#### options.ref
Type: `String`
Default value: `null`
See [node-touch options](https://github.com/isaacs/node-touch#options).
like `touch -r <file>`, where `<file>` is a path to a file
Additionally the following option is supported:
#### options.nocreate
### match
Type: `Boolean`
Default value: `false`
like `touch -c`

### Usage Examples

```js
grunt.initConfig({
touch: {
options: {
force: true,
mtime: true
},
src: ['test'],
}
});
```
By default a list of file paths is expected - those files will be touched.
If you want to match the files by using patterns instead, set `match` to `true`.
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).
## Release History
0.1.0 - initial release
## License
Copyright (c) 2013 Paul Spencer. Copyright (c) 2016 FatFisz. Licensed under the MIT license.

0 comments on commit 112189b

Please sign in to comment.