assets-webpack-plugin
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -14,2 +14,6 @@ var mkdirp = require('mkdirp'); | ||
options.processOutput = options.processOutput || function (assets) { | ||
return JSON.stringify(assets, null, options.prettyPrint ? 2 : null); | ||
}; | ||
return function writeOutput (newAssets, next) { | ||
@@ -40,3 +44,3 @@ // if potions.update is false and we're on the first pass of a (possibly) multicompiler | ||
var assets = merge({}, oldAssets, newAssets); | ||
var output = JSON.stringify(assets, null, options.prettyPrint ? 2 : null); | ||
var output = options.processOutput(assets); | ||
@@ -43,0 +47,0 @@ fs.writeFile(outputPath, output, function (err) { |
{ | ||
"name": "assets-webpack-plugin", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Emits a json file with assets paths", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -91,18 +91,22 @@ assets-webpack-plugin | ||
__path__: Path where to save the created json file. Defaults to the current directory. | ||
__filename__: Name for the created json file. Defaults to `webpack-assets.json` | ||
```js | ||
new AssetsPlugin({path: path.join(__dirname, 'app', 'views')}) | ||
new AssetsPlugin({filename: 'assets.json'}) | ||
``` | ||
__filename__: Name for the created json file. Defaults to `webpack-assets.json` | ||
__fullPath__: True by default. If false the output will not include the full path of the generated file. | ||
```js | ||
new AssetsPlugin({filename: 'assets.json'}) | ||
new AssetsPlugin({fullPath: false}) | ||
``` | ||
__update__: When set to true, the output json file will be updated instead of overwritten. Defaults to false. | ||
e.g. | ||
`/public/path/bundle.js` vs `bundle.js vs` | ||
__path__: Path where to save the created json file. Defaults to the current directory. | ||
```js | ||
new AssetsPlugin({update: true}) | ||
new AssetsPlugin({path: path.join(__dirname, 'app', 'views')}) | ||
``` | ||
@@ -116,2 +120,18 @@ | ||
__processOutput__: Formats the assets output. Defaults is JSON stringify function. | ||
```js | ||
new AssetsPlugin({ | ||
processOutput: function (assets) { | ||
return 'window.staticMap = ' + JSON.stringify(assets); | ||
} | ||
}) | ||
``` | ||
__update__: When set to true, the output json file will be updated instead of overwritten. Defaults to false. | ||
```js | ||
new AssetsPlugin({update: true}) | ||
``` | ||
### Using in multi-compiler mode | ||
@@ -178,1 +198,8 @@ | ||
``` | ||
## Changelog | ||
__3.2.0__ Added `processOutput` option | ||
__3.1.0__ Config now accepts a `fullPath` option. | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34379
916
203