assets-webpack-plugin
Advanced tools
Comparing version 3.9.3 to 3.9.4
@@ -11,2 +11,6 @@ # Change Log | ||
## 3.9.4 - 2018-08-08 | ||
- Adds the `includeAllFileTypes`, and `fileTypes` options for controlling which files are included in the assets file. | ||
## 3.9.3 - 2018-08-07 | ||
@@ -13,0 +17,0 @@ |
@@ -23,3 +23,5 @@ 'use strict'; | ||
manifestFirst: true, | ||
useCompilerPath: false | ||
useCompilerPath: false, | ||
fileTypes: ['js', 'css'], | ||
includeAllFileTypes: true | ||
}, options); | ||
@@ -35,3 +37,3 @@ this.writer = createQueuedWriter(createOutputWriter(this.options)); | ||
self.options.path = path.resolve(self.options.useCompilerPath ? compiler.options.output.path : self.options.path || '.'); | ||
self.options.path = path.resolve(self.options.useCompilerPath ? compiler.options.output.path || '.' : self.options.path || '.'); | ||
@@ -80,16 +82,18 @@ var afterEmit = function afterEmit(compilation, callback) { | ||
var typeName = getAssetKind(options, asset); | ||
var combinedPath = assetPath && assetPath.slice(-1) !== '/' ? assetPath + '/' + asset : assetPath + asset; | ||
var type = _typeof(typeMap[typeName]); | ||
if (type === 'undefined') { | ||
typeMap[typeName] = combinedPath; | ||
} else { | ||
if (type === 'string') { | ||
typeMap[typeName] = [typeMap[typeName]]; | ||
if (self.options.includeAllFileTypes || self.options.fileTypes.includes(typeName)) { | ||
var combinedPath = assetPath && assetPath.slice(-1) !== '/' ? assetPath + '/' + asset : assetPath + asset; | ||
var type = _typeof(typeMap[typeName]); | ||
if (type === 'undefined') { | ||
typeMap[typeName] = combinedPath; | ||
} else { | ||
if (type === 'string') { | ||
typeMap[typeName] = [typeMap[typeName]]; | ||
} | ||
typeMap[typeName].push(combinedPath); | ||
} | ||
typeMap[typeName].push(combinedPath); | ||
added = true; | ||
seenAssets[asset] = true; | ||
return typeMap; | ||
} | ||
added = true; | ||
seenAssets[asset] = true; | ||
return typeMap; | ||
}, {}); | ||
@@ -96,0 +100,0 @@ |
32
index.js
@@ -19,3 +19,5 @@ var fs = require('fs') | ||
manifestFirst: true, | ||
useCompilerPath: false | ||
useCompilerPath: false, | ||
fileTypes: ['js', 'css'], | ||
includeAllFileTypes: true | ||
}, options) | ||
@@ -32,3 +34,3 @@ this.writer = createQueuedWriter(createOutputWriter(this.options)) | ||
self.options.path = path.resolve(self.options.useCompilerPath | ||
? compiler.options.output.path : self.options.path || '.') | ||
? (compiler.options.output.path || '.') : (self.options.path || '.')) | ||
@@ -77,16 +79,18 @@ var afterEmit = (compilation, callback) => { | ||
var typeName = getAssetKind(options, asset) | ||
var combinedPath = assetPath && assetPath.slice(-1) !== '/' ? `${assetPath}/${asset}` : assetPath + asset | ||
var type = typeof typeMap[typeName] | ||
if (type === 'undefined') { | ||
typeMap[typeName] = combinedPath | ||
} else { | ||
if (type === 'string') { | ||
typeMap[typeName] = [typeMap[typeName]] | ||
if (self.options.includeAllFileTypes || self.options.fileTypes.includes(typeName)) { | ||
var combinedPath = assetPath && assetPath.slice(-1) !== '/' ? `${assetPath}/${asset}` : assetPath + asset | ||
var type = typeof typeMap[typeName] | ||
if (type === 'undefined') { | ||
typeMap[typeName] = combinedPath | ||
} else { | ||
if (type === 'string') { | ||
typeMap[typeName] = [typeMap[typeName]] | ||
} | ||
typeMap[typeName].push(combinedPath) | ||
} | ||
typeMap[typeName].push(combinedPath) | ||
added = true | ||
seenAssets[asset] = true | ||
return typeMap | ||
} | ||
added = true | ||
seenAssets[asset] = true | ||
return typeMap | ||
}, {}) | ||
@@ -93,0 +97,0 @@ |
{ | ||
"name": "assets-webpack-plugin", | ||
"version": "3.9.3", | ||
"version": "3.9.4", | ||
"description": "Emits a json file with assets paths", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -232,2 +232,22 @@ # assets-webpack-plugin | ||
#### `includeAllFileTypes` | ||
Optional. `true` by default. | ||
When set false, falls back to the `fileTypes` option array to decide while file types to include in the assets file. | ||
```js | ||
new AssetsPlugin({includeAllFileTypes: false}) | ||
``` | ||
#### `fileTypes` | ||
Optional. ```['js', 'css']``` by default. | ||
When set and `includeAllFileTypes` is set false, only assets matching these types will be included in the assets file. | ||
```js | ||
new AssetsPlugin({fileTypes: ['js', 'jpg']]}) | ||
``` | ||
### Using in multi-compiler mode | ||
@@ -234,0 +254,0 @@ |
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
36790
518
314