@caweb/webpack 1.2.4 → 1.2.6
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/package.json +6 -6
- package/webpack.config.js +35 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caweb/webpack",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "CAWebPublishing Webpack Configuration",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"preserve": "cd plugins/html && npm i",
|
|
13
13
|
"serve": "set NODE_OPTIONS='--no-selectors' && webpack serve --config ./webpack.config.js",
|
|
14
14
|
"build": "npm run build:html",
|
|
15
|
-
"build:html": "cd ./plugins/html/ && npm run build",
|
|
15
|
+
"build:html": "cd ./plugins/html/ && npm i && npm run build",
|
|
16
16
|
"u:deps": "node ./scripts/update-deps.js ./plugins",
|
|
17
17
|
"config:test": "webpack configtest ./webpack.config.js",
|
|
18
18
|
"test": "echo \\\"Error: run tests from root\\\" && exit 0",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://github.com/CAWebPublishing/webpack#readme",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@caweb/a11y-webpack-plugin": "^1.0.
|
|
43
|
-
"@caweb/css-audit-webpack-plugin": "^1.0.
|
|
44
|
-
"@caweb/html-webpack-plugin": "^1.
|
|
45
|
-
"@caweb/jshint-webpack-plugin": "^1.0.
|
|
42
|
+
"@caweb/a11y-webpack-plugin": "^1.0.6",
|
|
43
|
+
"@caweb/css-audit-webpack-plugin": "^1.0.9",
|
|
44
|
+
"@caweb/html-webpack-plugin": "^1.3.0",
|
|
45
|
+
"@caweb/jshint-webpack-plugin": "^1.0.7",
|
|
46
46
|
"@wordpress/scripts": "^28.4.0",
|
|
47
47
|
"html-webpack-skip-assets-plugin": "^1.0.4"
|
|
48
48
|
}
|
package/webpack.config.js
CHANGED
|
@@ -17,38 +17,43 @@ import A11yPlugin from '@caweb/a11y-webpack-plugin';
|
|
|
17
17
|
|
|
18
18
|
import {HtmlWebpackSkipAssetsPlugin} from 'html-webpack-skip-assets-plugin';
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
let scheme = 'oceanside';
|
|
20
|
+
const webpackCommand = 'build' === process.argv[2] ? 'build' : 'serve' ;
|
|
22
21
|
|
|
23
|
-
//
|
|
24
|
-
if(
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if(
|
|
30
|
-
|
|
22
|
+
// only if serving do we add the plugins
|
|
23
|
+
if( 'serve' === webpackCommand ){
|
|
24
|
+
let template = 'default';
|
|
25
|
+
let scheme = 'oceanside';
|
|
26
|
+
|
|
27
|
+
// Allow for template to be selected via NODE_OPTIONS env variable
|
|
28
|
+
if( process.env.NODE_OPTIONS ){
|
|
29
|
+
let opts = process.env.NODE_OPTIONS.split(' ').filter(e=>e).map(o=>o.replaceAll("'", ''))
|
|
30
|
+
if( opts.includes('--template') ){
|
|
31
|
+
template = opts[opts.indexOf('--template') + 1]
|
|
32
|
+
}
|
|
33
|
+
if( opts.includes('--scheme') ){
|
|
34
|
+
scheme = opts[opts.indexOf('--scheme') + 1]
|
|
35
|
+
}
|
|
31
36
|
}
|
|
37
|
+
|
|
38
|
+
// Page Template and additional plugins
|
|
39
|
+
webpackConfig.plugins.push(
|
|
40
|
+
new CAWebHTMLPlugin({
|
|
41
|
+
template,
|
|
42
|
+
templateParameters: {
|
|
43
|
+
scheme
|
|
44
|
+
},
|
|
45
|
+
skipAssets: [
|
|
46
|
+
/.*-rtl.css/, // we skip the Right-to-Left Styles
|
|
47
|
+
/css-audit.*/, // we skip the CSSAudit Files
|
|
48
|
+
/a11y.*/, // we skip the A11y Files
|
|
49
|
+
/jshint.*/, // we skip the JSHint Files
|
|
50
|
+
]
|
|
51
|
+
}),
|
|
52
|
+
new HtmlWebpackSkipAssetsPlugin(),
|
|
53
|
+
new JSHintPlugin(),
|
|
54
|
+
new CSSAuditPlugin(),
|
|
55
|
+
new A11yPlugin()
|
|
56
|
+
)
|
|
32
57
|
}
|
|
33
58
|
|
|
34
|
-
// Page Template and additional plugins
|
|
35
|
-
webpackConfig.plugins.push(
|
|
36
|
-
new CAWebHTMLPlugin({
|
|
37
|
-
template,
|
|
38
|
-
templateParameters: {
|
|
39
|
-
scheme
|
|
40
|
-
},
|
|
41
|
-
skipAssets: [
|
|
42
|
-
/.*-rtl.css/, // we skip the Right-to-Left Styles
|
|
43
|
-
/css-audit.*/, // we skip the CSSAudit Files
|
|
44
|
-
/a11y.*/, // we skip the A11y Files
|
|
45
|
-
/jshint.*/, // we skip the JSHint Files
|
|
46
|
-
]
|
|
47
|
-
}),
|
|
48
|
-
new HtmlWebpackSkipAssetsPlugin(),
|
|
49
|
-
new JSHintPlugin(),
|
|
50
|
-
new CSSAuditPlugin(),
|
|
51
|
-
new A11yPlugin()
|
|
52
|
-
)
|
|
53
|
-
|
|
54
59
|
export default webpackConfig;
|