@caweb/html-webpack-plugin 1.5.1 → 1.5.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 (86) hide show
  1. package/build/delta-rtl.css +231 -231
  2. package/build/delta-rtl.min.css +2 -2
  3. package/build/delta.asset.php +1 -1
  4. package/build/delta.css +231 -231
  5. package/build/delta.css.map +1 -1
  6. package/build/delta.min.asset.php +1 -1
  7. package/build/delta.min.css +2 -2
  8. package/build/eureka-rtl.css +231 -231
  9. package/build/eureka-rtl.min.css +2 -2
  10. package/build/eureka.asset.php +1 -1
  11. package/build/eureka.css +231 -231
  12. package/build/eureka.css.map +1 -1
  13. package/build/eureka.min.asset.php +1 -1
  14. package/build/eureka.min.css +2 -2
  15. package/build/mono-rtl.css +221 -221
  16. package/build/mono-rtl.min.css +2 -2
  17. package/build/mono.asset.php +1 -1
  18. package/build/mono.css +221 -221
  19. package/build/mono.css.map +1 -1
  20. package/build/mono.min.asset.php +1 -1
  21. package/build/mono.min.css +2 -2
  22. package/build/oceanside-rtl.css +231 -231
  23. package/build/oceanside-rtl.min.css +2 -2
  24. package/build/oceanside.asset.php +1 -1
  25. package/build/oceanside.css +231 -231
  26. package/build/oceanside.css.map +1 -1
  27. package/build/oceanside.min.asset.php +1 -1
  28. package/build/oceanside.min.css +2 -2
  29. package/build/orangecounty-rtl.css +231 -231
  30. package/build/orangecounty-rtl.min.css +2 -2
  31. package/build/orangecounty.asset.php +1 -1
  32. package/build/orangecounty.css +231 -231
  33. package/build/orangecounty.css.map +1 -1
  34. package/build/orangecounty.min.asset.php +1 -1
  35. package/build/orangecounty.min.css +2 -2
  36. package/build/pasorobles-rtl.css +225 -225
  37. package/build/pasorobles-rtl.min.css +2 -2
  38. package/build/pasorobles.asset.php +1 -1
  39. package/build/pasorobles.css +225 -225
  40. package/build/pasorobles.css.map +1 -1
  41. package/build/pasorobles.min.asset.php +1 -1
  42. package/build/pasorobles.min.css +2 -2
  43. package/build/sacramento-rtl.css +222 -222
  44. package/build/sacramento-rtl.min.css +2 -2
  45. package/build/sacramento.asset.php +1 -1
  46. package/build/sacramento.css +222 -222
  47. package/build/sacramento.css.map +1 -1
  48. package/build/sacramento.min.asset.php +1 -1
  49. package/build/sacramento.min.css +2 -2
  50. package/build/santabarbara-rtl.css +231 -231
  51. package/build/santabarbara-rtl.min.css +2 -2
  52. package/build/santabarbara.asset.php +1 -1
  53. package/build/santabarbara.css +231 -231
  54. package/build/santabarbara.css.map +1 -1
  55. package/build/santabarbara.min.asset.php +1 -1
  56. package/build/santabarbara.min.css +2 -2
  57. package/build/santacruz-rtl.css +231 -231
  58. package/build/santacruz-rtl.min.css +2 -2
  59. package/build/santacruz.asset.php +1 -1
  60. package/build/santacruz.css +231 -231
  61. package/build/santacruz.css.map +1 -1
  62. package/build/santacruz.min.asset.php +1 -1
  63. package/build/santacruz.min.css +2 -2
  64. package/build/shasta-rtl.css +231 -231
  65. package/build/shasta-rtl.min.css +2 -2
  66. package/build/shasta.asset.php +1 -1
  67. package/build/shasta.css +231 -231
  68. package/build/shasta.css.map +1 -1
  69. package/build/shasta.min.asset.php +1 -1
  70. package/build/shasta.min.css +2 -2
  71. package/build/sierra-rtl.css +231 -231
  72. package/build/sierra-rtl.min.css +2 -2
  73. package/build/sierra.asset.php +1 -1
  74. package/build/sierra.css +231 -231
  75. package/build/sierra.css.map +1 -1
  76. package/build/sierra.min.asset.php +1 -1
  77. package/build/sierra.min.css +2 -2
  78. package/build/trinity-rtl.css +231 -231
  79. package/build/trinity-rtl.min.css +2 -2
  80. package/build/trinity.asset.php +1 -1
  81. package/build/trinity.css +231 -231
  82. package/build/trinity.css.map +1 -1
  83. package/build/trinity.min.asset.php +1 -1
  84. package/build/trinity.min.css +2 -2
  85. package/package.json +3 -2
  86. package/webpack.config.js +40 -32
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/html-webpack-plugin",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "CAWebPublishing Sample Page and Configurations",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,7 +25,8 @@
25
25
  "generate-json": "node ./scripts/icon.js",
26
26
  "serve": "webpack serve --config ./webpack.config.js ./entry/oceanside.js ./scripts/webpack.test.js --merge",
27
27
  "serve:quick": "set NODE_OPTIONS='--no-jshint --no-audit --no-a11y' && webpack serve --config ./webpack.config.js ./entry/oceanside.js ./scripts/webpack.test.js --merge",
28
- "test": "echo \"Error: run tests from root\" && exit 0"
28
+ "test": "echo \"Error: run tests from root\" && exit 0",
29
+ "t": "webpack build --config ./webpack.test.js"
29
30
  },
30
31
  "repository": {
31
32
  "type": "git",
package/webpack.config.js CHANGED
@@ -50,10 +50,13 @@ function processArgs( arr ){
50
50
  return tmp
51
51
  }
52
52
 
53
- function getArgVal(flag){
54
- return flags.includes(flag) ? flags[flags.indexOf(flag) + 1] : false;
53
+ function flagExists(flag){
54
+ return flags.includes(flag)
55
55
  }
56
56
 
57
+ function getArgVal(flag){
58
+ return flagExists(flag) ? flags[flags.indexOf(flag) + 1] : false;
59
+ }
57
60
 
58
61
  // Update some of the default WordPress webpack rules.
59
62
  baseConfig.module.rules.forEach((rule, i) => {
@@ -97,12 +100,14 @@ delete baseConfig.devServer;
97
100
  let mode = getArgVal('--mode') ? getArgVal('--mode') : baseConfig.mode;
98
101
 
99
102
  let webpackConfig = {
103
+ ...baseConfig,
100
104
  mode,
101
105
  name: 'uncompressed',
102
106
  target: 'web',
103
107
  cache: false,
104
108
  stats: 'errors',
105
109
  output: {
110
+ ...baseConfig.output,
106
111
  clean: mode === 'production'
107
112
  },
108
113
  performance: {
@@ -110,7 +115,9 @@ let webpackConfig = {
110
115
  maxEntrypointSize: 500000
111
116
  },
112
117
  module:{
118
+ ...baseConfig.module,
113
119
  rules: [
120
+ ...baseConfig.module.rules,
114
121
  /**
115
122
  * Default template loader for html is lodash,
116
123
  * lets switch to handlebars
@@ -230,7 +237,7 @@ if( 'serve' === webpackCommand ){
230
237
  }
231
238
 
232
239
  // Page Template and additional plugins
233
- webpackConfig.plugins = [
240
+ webpackConfig.plugins.push(
234
241
  new CAWebHTMLPlugin({
235
242
  template,
236
243
  templateParameters: {
@@ -246,34 +253,35 @@ if( 'serve' === webpackCommand ){
246
253
  }),
247
254
  new HtmlWebpackSkipAssetsPlugin(),
248
255
  new HtmlWebpackLinkTypePlugin(),
249
- ! getArgVal('--no-jshint') ? new JSHintPlugin() : false,
250
- ! getArgVal('--no-audit') ? new CSSAuditPlugin() : false,
251
- ! getArgVal('--no-a11y') ? new A11yPlugin() : false
252
- ]
256
+ ! flagExists('--no-jshint') ? new JSHintPlugin() : false,
257
+ ! flagExists('--no-audit') ? new CSSAuditPlugin() : false,
258
+ ! flagExists('--no-a11y') ? new A11yPlugin() : false
259
+ )
253
260
  }
254
261
 
255
- export default [
256
- baseConfig,
257
- webpackConfig,
258
- mode === 'production' ?
259
- {
260
- name: 'compressed',
261
- dependencies: ['uncompressed'],
262
- devtool: false,
263
- output: {
264
- filename: '[name].min.js',
265
- chunkFilename: '[name].min.js?v=[chunkhash]',
266
- },
267
- plugins: [
268
- new MiniCSSExtractPlugin( { filename: '[name].min.css' } ),
269
- new RtlCssPlugin( { filename: '[name]-rtl.min.css' } ),
270
- ],
271
- optimization:{
272
- minimize: true,
273
- minimizer: [
274
- `...`,
275
- new CssMinimizerPlugin({test: /\.min\.css$/})
276
- ]
277
- }
278
- } : false
279
- ].filter(Boolean);
262
+ /**
263
+ * Production only
264
+ */
265
+ if( mode === 'production' ){
266
+ // Config
267
+ webpackConfig.name = 'compressed';
268
+ webpackConfig.devtool = false;
269
+
270
+ // Output
271
+ webpackConfig.output.filename = '[name].min.js';
272
+ webpackConfig.output.chunkFilename = '[name].min.js?v=[chunkhash]';
273
+
274
+ // Plugins
275
+ webpackConfig.plugins.push(
276
+ new MiniCSSExtractPlugin( { filename: '[name].min.css' } ),
277
+ new RtlCssPlugin( { filename: '[name]-rtl.min.css' } )
278
+ )
279
+
280
+ // Optimization
281
+ webpackConfig.optimization.minimize = true;
282
+ webpackConfig.optimization.minimizer.push(
283
+ new CssMinimizerPlugin({test: /\.min\.css$/})
284
+ )
285
+ }
286
+
287
+ export default webpackConfig;