@caweb/webpack 1.3.27 → 1.3.29

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.txt CHANGED
@@ -1,3 +1,9 @@
1
+ v1.3.29
2
+ - Updated npm packages
3
+
4
+ v1.3.28
5
+ - Updated npm packages
6
+
1
7
  v1.3.27
2
8
  - Updated npm packages
3
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/webpack",
3
- "version": "1.3.27",
3
+ "version": "1.3.29",
4
4
  "description": "CAWebPublishing Webpack Configuration",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@caweb/a11y-webpack-plugin": "^1.0.9",
39
39
  "@caweb/css-audit-webpack-plugin": "^1.0.12",
40
- "@caweb/html-webpack-plugin": "^1.5.29",
40
+ "@caweb/html-webpack-plugin": "^1.6.1",
41
41
  "@caweb/jshint-webpack-plugin": "^2.0.1"
42
42
  }
43
43
  }
@@ -1,3 +1,10 @@
1
+ v1.6.1
2
+ - Fixed issue with scrolling removing styles when adding scroll-margin-top
3
+
4
+ v1.6.0
5
+ - Added new Search Engine Results Page (SERP) template
6
+ - Search Bar now only appears in header when not on SERP page
7
+
1
8
  v1.5.29
2
9
  - Added sanity check before scrolling
3
10
 
@@ -39,7 +39,7 @@ class CAWebHTMLPlugin extends HtmlWebpackPlugin{
39
39
 
40
40
  // we change some of the html-webpack-plugin defaults
41
41
  constructor(opts = {}) {
42
- let templates = ['blank', 'default'];
42
+ let templates = ['blank', 'default', 'search'];
43
43
 
44
44
  let defaultOptions = {
45
45
  title: path.basename( appPath ),
@@ -54,6 +54,7 @@ class CAWebHTMLPlugin extends HtmlWebpackPlugin{
54
54
  "viewport": "width=device-width, initial-scale=1.0, maximum-scale=2.0"
55
55
  },
56
56
  templateParameters: {
57
+ "template": "default",
57
58
  "title": path.basename( appPath ),
58
59
  "scheme": "oceanside",
59
60
  "logo": "https://caweb.cdt.ca.gov/wp-content/uploads/sites/221/2023/06/caweb-publishing-logo.png"
@@ -65,6 +66,17 @@ class CAWebHTMLPlugin extends HtmlWebpackPlugin{
65
66
  defaultOptions.templateParameters.title = opts.title;
66
67
  }
67
68
 
69
+ // if template selection is one of ours
70
+ if( opts.template && templates.includes(opts.template) ){
71
+ let template = opts.template;
72
+ // update template file based on template selection
73
+ opts.template = path.join( currentPath, 'sample', `${template}.html`);
74
+
75
+ // update default.templateParameters.template to match user options.
76
+ defaultOptions.templateParameters.template = template;
77
+ }
78
+
79
+ // if there is a caweb.json file we merge the site data with the templateParameters
68
80
  if( fs.existsSync( path.join(appPath, 'caweb.json') ) ){
69
81
 
70
82
  let dataFile = JSON.parse( fs.readFileSync( path.join(appPath, 'caweb.json') ) );
@@ -80,11 +92,6 @@ class CAWebHTMLPlugin extends HtmlWebpackPlugin{
80
92
 
81
93
  }
82
94
 
83
- // select template file based on template selection if template is one of ours
84
- if( opts.template && templates.includes(opts.template) ){
85
- opts.template = path.join( currentPath, 'sample', `${opts.template}.html`);
86
- }
87
-
88
95
  super(deepmerge(defaultOptions, opts));
89
96
 
90
97
  }
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@caweb/html-webpack-plugin",
3
- "version": "1.5.29",
3
+ "version": "1.6.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@caweb/html-webpack-plugin",
9
- "version": "1.5.29",
9
+ "version": "1.6.1",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@caweb/a11y-webpack-plugin": "^1.0.9",
13
13
  "@caweb/css-audit-webpack-plugin": "^1.0.12",
14
14
  "@caweb/jshint-webpack-plugin": "^2.0.1",
15
15
  "@wordpress/scripts": "^30.12.0",
16
- "css-minimizer-webpack-plugin": "^7.0.0",
16
+ "css-minimizer-webpack-plugin": "^7.0.2",
17
17
  "handlebars-loader": "^1.7.3",
18
18
  "html-webpack-link-type-plugin": "^1.1.1",
19
19
  "html-webpack-plugin": "^5.6.3",
@@ -8258,15 +8258,15 @@
8258
8258
  }
8259
8259
  },
8260
8260
  "node_modules/css-minimizer-webpack-plugin": {
8261
- "version": "7.0.0",
8262
- "resolved": "https://registry.npmjs.org/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-7.0.0.tgz",
8263
- "integrity": "sha512-niy66jxsQHqO+EYbhPuIhqRQ1mNcNVUHrMnkzzir9kFOERJUaQDDRhh7dKDz33kBpkWMF9M8Vx0QlDbc5AHOsw==",
8261
+ "version": "7.0.2",
8262
+ "resolved": "https://registry.npmjs.org/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-7.0.2.tgz",
8263
+ "integrity": "sha512-nBRWZtI77PBZQgcXMNqiIXVshiQOVLGSf2qX/WZfG8IQfMbeHUMXaBWQmiiSTmPJUflQxHjZjzAmuyO7tpL2Jg==",
8264
8264
  "license": "MIT",
8265
8265
  "dependencies": {
8266
8266
  "@jridgewell/trace-mapping": "^0.3.25",
8267
- "cssnano": "^7.0.1",
8267
+ "cssnano": "^7.0.4",
8268
8268
  "jest-worker": "^29.7.0",
8269
- "postcss": "^8.4.38",
8269
+ "postcss": "^8.4.40",
8270
8270
  "schema-utils": "^4.2.0",
8271
8271
  "serialize-javascript": "^6.0.2"
8272
8272
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/html-webpack-plugin",
3
- "version": "1.5.29",
3
+ "version": "1.6.1",
4
4
  "description": "CAWebPublishing Sample Page and Configurations",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -120,7 +120,7 @@
120
120
  "@caweb/css-audit-webpack-plugin": "^1.0.12",
121
121
  "@caweb/jshint-webpack-plugin": "^2.0.1",
122
122
  "@wordpress/scripts": "^30.12.0",
123
- "css-minimizer-webpack-plugin": "^7.0.0",
123
+ "css-minimizer-webpack-plugin": "^7.0.2",
124
124
  "handlebars-loader": "^1.7.3",
125
125
  "html-webpack-link-type-plugin": "^1.1.1",
126
126
  "html-webpack-plugin": "^5.6.3",
@@ -27,8 +27,8 @@
27
27
  </head>
28
28
  <body>
29
29
  {{> header }}
30
- <div id="page-container" class="page-container ">
31
- <div id="main-content" class="main-content " tabindex="-1">
30
+ <div id="page-container" class="page-container">
31
+ <div id="main-content" class="main-content" tabindex="-1">
32
32
  <main class="main-primary">
33
33
  {{#if htmlWebpackPlugin.options.templateParameters.bodyHtmlSnippet }}
34
34
  {{{ htmlWebpackPlugin.options.templateParameters.bodyHtmlSnippet }}}
@@ -0,0 +1,55 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>{{ title }}</title>
5
+ {{#if scheme }}
6
+ <!-- Icon Font Library -->
7
+ <link rel="stylesheet" href="node_modules/@caweb/html-webpack-plugin/build/font-only.css" />
8
+
9
+ <!-- Template Scheme CSS -->
10
+ <link rel="stylesheet" href="node_modules/@caweb/html-webpack-plugin/build/{{ scheme }}.css" />
11
+ {{/if}}
12
+
13
+
14
+ {{#if htmlWebpackPlugin.options.meta }}
15
+ {{#each htmlWebpackPlugin.options.meta }}
16
+ <meta name="{{ @key }}" content="{{ this }}">
17
+ {{/each}}
18
+ {{/if}}
19
+
20
+ {{#if assets }}
21
+ {{#each assets }}
22
+ {{#if (endsWith this ".css") }}
23
+ <link rel="stylesheet" href="{{ this }}" />
24
+ {{/if}}
25
+ {{/each}}
26
+ {{/if}}
27
+ </head>
28
+ <body class="page-template-serp">
29
+ {{> header }}
30
+ <div id="page-container" class="page-container">
31
+ <div id="main-content" class="main-content" tabindex="-1">
32
+ <main class="main-primary">
33
+ <div class="section">
34
+ <div class="container">
35
+ {{> './structural/search.html' }}
36
+ <h1>Search results for: </h1>
37
+ <gcse:searchresults-only></gcse:searchresults-only>
38
+ </div>
39
+ </div>
40
+ </main>
41
+ </div>
42
+ </div>
43
+ {{> footer }}
44
+ {{#if scheme }}
45
+ <script src="node_modules/@caweb/html-webpack-plugin/build/{{ scheme }}.js"></script>
46
+ {{/if}}
47
+ {{#if assets }}
48
+ {{#each assets }}
49
+ {{#if (endsWith this ".js") }}
50
+ <script src="{{ this }}"></script>
51
+ {{/if}}
52
+ {{/each}}
53
+ {{/if}}
54
+ </body>
55
+ </html>
@@ -8,7 +8,13 @@
8
8
  {{/if}}
9
9
  </a>
10
10
  </div>
11
- {{> './search.html' }}
11
+ {{#if google.search }}
12
+ {{#ifCond 'search' '!==' htmlWebpackPlugin.options.templateParameters.template }}
13
+
14
+ {{> './search.html' }}
15
+
16
+ {{/ifCond}}
17
+ {{/if}}
12
18
  <button class="mobile-control toggle-menu ca-gov-icon-menu fs-2" data-bs-toggle="collapse" data-bs-target=".mobile-controlled" aria-expanded="false" aria-controls="mobile-controls" aria-label="Open the navigation menu">
13
19
  </button>
14
20
  </div>
@@ -1,4 +1,3 @@
1
- {{#if google.search }}
2
1
  <!-- Search -->
3
2
  <div class="search-container">
4
3
  <form action="/serp.html" role="search">
@@ -11,5 +10,4 @@
11
10
  </button>
12
11
  </div>
13
12
  </form>
14
- </div>
15
- {{/if}}
13
+ </div>
@@ -268,6 +268,35 @@ if( 'serve' === webpackCommand ){
268
268
  ! flagExists('--no-audit') ? new CSSAuditPlugin() : false,
269
269
  ! flagExists('--no-a11y') ? new A11yPlugin() : false
270
270
  )
271
+
272
+ // we add the SERP (Search Engine Results Page)
273
+ // if the caweb.json has a google search id
274
+ if( fs.existsSync( path.join(appPath, 'caweb.json') ) ){
275
+ let dataFile = JSON.parse( fs.readFileSync( path.join(appPath, 'caweb.json') ) );
276
+
277
+ if( dataFile.site.google.search ){
278
+ webpackConfig.plugins.push(
279
+ new CAWebHTMLPlugin({
280
+ template: 'search',
281
+ templateParameters: {
282
+ scheme: 'false' !== scheme ? scheme : false
283
+ },
284
+ filename: 'serp.html',
285
+ title: 'Search Results Page',
286
+ skipAssets: [
287
+ /.*-rtl.css/, // we skip the Right-to-Left Styles
288
+ /css-audit.*/, // we skip the CSSAudit Files
289
+ /a11y.*/, // we skip the A11y Files
290
+ /jshint.*/, // we skip the JSHint Files
291
+ /font-only.*/, // we skip the font-only Files
292
+ ]
293
+ })
294
+ )
295
+ }
296
+
297
+ }
298
+
299
+
271
300
  }
272
301
 
273
302
  /**