Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/packingjs/packing-rev-webpack-plugin
https://github.com/packingjs/packing-rev-webpack-plugin
Last synced: 30 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/packingjs/packing-rev-webpack-plugin
- Owner: packingjs
- Created: 2016-07-06T11:08:50.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-08T04:38:18.000Z (over 7 years ago)
- Last Synced: 2024-10-29T07:09:48.895Z (2 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Packing Rev Webpack Plugin
[![NPM](https://nodei.co/npm/packing-rev-webpack-plugin.png)](https://nodei.co/npm/packing-rev-webpack-plugin/)
This is a [webpack](http://webpack.github.io/) plugin that reversion files to the build directory.
### Getting started
Install the plugin:
```
npm install --save-dev packing-rev-webpack-plugin
```### Usage
`new RevWebpackPlugin([patterns], options)`
new RevWebpackPlugin({
cwd: path.join(cwd, assets),
src: '**/*.{jpg,png}',
dest: path.join(cwd, assetsDist),
}),A pattern looks like:
`{ cwd: '', src: '**/*', dest: 'dest' }`#### Pattern properties:
* `src`
- is required
- can be a glob
- can be an Array
* `dest`
- is optional
- if not absolute, it's relative to the build root
* `cwd`
- is optional
- The base directory (absolute path!) for reversion
- defaults to process.cwd()
* `glob`
- is optional
- [glob](https://github.com/isaacs/node-glob) options#### Available options:
* `format`
- is optional
- reversion name format
- default value is `[name]-[hash][ext]`
* `algorithm`
- is optional
- default value is `sha256`
* `length`
- is optional
- default value is `8`### Examples
```javascript
var RevWebpackPlugin = require('packing-rev-webpack-plugin');
var path = require('path');module.exports = {
plugins: [
new RevWebpackPlugin([
{ src: 'from/file.txt', dest: 'dist' },// {output}/to/file.txt
{ cwd: 'assets', src: 'images/**/*', dest: 'imgs' }
]),
new RevWebpackPlugin([
{ src: ['**/*.png', '!notrev.png'], dest: 'dist' },// {output}/to/file.txt
{ cwd: 'assets', src: 'images/**/*', dest: 'imgs' }
])
]
};
```