@caweb/html-webpack-plugin 1.8.1 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/index.js +27 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -18,6 +18,7 @@ const boldBlue = chalk.bold.hex('#03a7fc');
|
|
|
18
18
|
const currentPath = path.dirname(fileURLToPath(import.meta.url));
|
|
19
19
|
const appPath = process.cwd();
|
|
20
20
|
const templatePath = path.resolve(currentPath, '..', 'template');
|
|
21
|
+
const iconLibraryPath = path.resolve(currentPath, '..', 'icon-library');
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Launches CAWeb HTML Markup
|
|
@@ -145,7 +146,7 @@ class CAWebHtmlWebpackPlugin extends HtmlWebpackPlugin{
|
|
|
145
146
|
// if the html contains local assets those assets are added to the options.assets array
|
|
146
147
|
// and the assets are added to the compilation afterEmit
|
|
147
148
|
let additionalAssets = html.match(/(src|href)="(.+?)"/g);
|
|
148
|
-
|
|
149
|
+
|
|
149
150
|
if( additionalAssets ){
|
|
150
151
|
additionalAssets.forEach( (asset) => {
|
|
151
152
|
let ref = asset.replace(/(src|href|=|")/g, '');
|
|
@@ -192,6 +193,31 @@ class CAWebHtmlWebpackPlugin extends HtmlWebpackPlugin{
|
|
|
192
193
|
asset.replace(appPath, '').replace(/[\\\/]?node_modules[\\\/@]+/g, ''),
|
|
193
194
|
new compiler.webpack.sources.RawSource( fs.readFileSync(asset) )
|
|
194
195
|
);
|
|
196
|
+
|
|
197
|
+
// if the asset is the @caweb/icon-library font-only.css file we have to also add the font files
|
|
198
|
+
if( asset.match(/@caweb\/icon-library\/build\/font-only-?.*.css/g) ){
|
|
199
|
+
let fontPath = path.join( iconLibraryPath, 'build', 'fonts' );
|
|
200
|
+
|
|
201
|
+
let fontFiles = fs.readdirSync(fontPath).filter( (file) => {
|
|
202
|
+
return file.endsWith('.woff') ||
|
|
203
|
+
file.endsWith('.woff2') ||
|
|
204
|
+
file.endsWith('.eot') ||
|
|
205
|
+
file.endsWith('.svg') ||
|
|
206
|
+
file.endsWith('.ttf');
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
fontFiles.forEach( (file) => {
|
|
210
|
+
compilation.fileDependencies.add( file );
|
|
211
|
+
|
|
212
|
+
let filePath = path.join( fontPath, file );
|
|
213
|
+
|
|
214
|
+
// we remove the appPath from the asset path
|
|
215
|
+
compilation.emitAsset(
|
|
216
|
+
filePath.replace(appPath, '').replace(/[\\\/]?node_modules[\\\/@]+/g, ''),
|
|
217
|
+
new compiler.webpack.sources.RawSource( fs.readFileSync(filePath) )
|
|
218
|
+
);
|
|
219
|
+
});
|
|
220
|
+
}
|
|
195
221
|
});
|
|
196
222
|
|
|
197
223
|
// Tell webpack to move on
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caweb/html-webpack-plugin",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "CAWebPublishing Site Generation HTML Webpack Plugin",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/CAWebPublishing/webpack/plugins/html#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@caweb/template": "^1.0.0-beta.
|
|
32
|
+
"@caweb/template": "^1.0.0-beta.2",
|
|
33
33
|
"html-webpack-plugin": "^5.6.3",
|
|
34
34
|
"webpack": "^5.99.8",
|
|
35
35
|
"webpack-cli": "^6.0.1"
|