@caweb/html-webpack-plugin 1.8.0 → 1.8.2

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/index.js +27 -1
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
+ v1.8.2
2
+ - Updated template utility links and nav-links references
3
+
4
+ v1.8.1
5
+ - Updated npm packages
6
+
1
7
  v1.8.0
2
8
  - Removed templating and css/js framework out, this is now solely used for Site Generation
9
+ - Src/href local files are now moved into the build directory
10
+ - Any references to the node_modules directory are removed
11
+ - Any organizational packages @ are also removed
3
12
 
4
13
  v1.7.13
5
14
  - Added card-none styles
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.0",
3
+ "version": "1.8.2",
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.0",
32
+ "@caweb/template": "^1.0.0-beta.1",
33
33
  "html-webpack-plugin": "^5.6.3",
34
34
  "webpack": "^5.99.8",
35
35
  "webpack-cli": "^6.0.1"