@studyportals/bob-manifest-generator
Advanced tools
Comparing version 1.3.0 to 1.4.0
{ | ||
"name": "@studyportals/bob-manifest-generator", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "A Webpack plugin that generates a manifest file for your microservice.", | ||
@@ -5,0 +5,0 @@ "main": "src/plugin.js", |
@@ -39,3 +39,5 @@ # BobManifestGenerator | ||
baseURL: string, | ||
exclude: string[] | ||
exclude: string[], | ||
async: string[], | ||
defer: string[] | ||
}) | ||
@@ -61,3 +63,4 @@ ] | ||
{ | ||
"url": "https://bucket.prtl.co/dist/styles.[hash].css" | ||
"url": "https://bucket.prtl.co/dist/styles.[hash].css", | ||
"defer": false | ||
} | ||
@@ -79,2 +82,3 @@ ] | ||
| `exclude` | An array of filenames to be excluded from the manifest. This can be just a filename or a filename including extension. When `true` is passed as a value, all assets will be excluded. | no (default: `[]`) | | ||
| `async` | An array of filenames to be loaded async. This can be just a filename or a filename including extension. Keep in mind that only javascript assets may be loaded async. When `true` is passed as a value, all javascript assets will be loaded async. | no (default: `[]`) | | ||
| `async` | An array of JS filenames to be loaded async. This can be just a filename or a filename including extension. Keep in mind that only javascript assets may be loaded async. When `true` is passed as a value, all javascript assets will be loaded async. | no (default: `[]`) | | ||
| `defer` | An array of CSS filenames to be lazy-loaded. This can be just a filename or a filename including extension. Keep in mind that only CSS assets may be lazy-loaded. When `true` is passed as a value, or when the value is omitted, all CSS assets will be lazy-loaded.| no (default: `[]`) | |
@@ -16,2 +16,3 @@ class BobManifestGenerator { | ||
this.async = options.async || []; | ||
this.defer = options.defer || []; | ||
} | ||
@@ -65,4 +66,3 @@ | ||
if(this.fileType(file) === 'js' && !this.matchFile(file, this.exclude)) { | ||
if(this.shouldProcessExtension(file, 'js')) { | ||
this.manifest.assets.js.push({ | ||
@@ -74,6 +74,6 @@ url: this.baseURL + '/' + file, | ||
if(this.fileType(file) === 'css' && !this.matchFile(file, this.exclude)) { | ||
if(this.shouldProcessExtension(file, 'css')) { | ||
this.manifest.assets.css.push({ | ||
url: this.baseURL + '/' + file | ||
url: this.baseURL + '/' + file, | ||
defer: this.matchFile(file, this.defer) | ||
}); | ||
@@ -84,2 +84,6 @@ } | ||
shouldProcessExtension(file, extension) { | ||
return this.fileType(file) === extension && !this.matchFile(file, this.exclude); | ||
} | ||
emitManifest(compilation) { | ||
@@ -122,3 +126,3 @@ | ||
} | ||
}) | ||
}); | ||
@@ -129,2 +133,2 @@ return matched; | ||
module.exports = BobManifestGenerator; | ||
module.exports = BobManifestGenerator; |
6454
93
82