PluginProbe
Hello Plus / 1.7.0
Hello Plus v1.7.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 All 30 releases
hello-plus / webpack.config.js

webpack.config.js in Hello Plus 1.7.0, at webpack.config.js

91 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 // WordPress webpack config.
2 const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
3
4 // Plugins.
5 const RemoveEmptyScriptsPlugin = require( 'webpack-remove-empty-scripts' );
6 const CopyWebpackPlugin = require( 'copy-webpack-plugin' );
7
8 // Utilities.
9 const path = require( 'path' );
10 const imagesPath = path.resolve( __dirname, './assets/images' );
11
12 const modulesDir = process.cwd() + '/modules/';
13 const devDir = process.cwd() + '/dev/';
14
15 const entryPoints = {
16 // Admin module:
17 'js/helloplus-onboarding': path.resolve( modulesDir, 'admin/assets/js', 'hello-plus-onboarding.js' ),
18 'js/helloplus-whats-new': path.resolve( modulesDir, 'admin/assets/js', 'hello-plus-whats-new.js' ),
19
20 // Content module
21 'css/helloplus-zigzag': path.resolve( modulesDir, 'content/assets/scss', 'hello-plus-zigzag.scss' ),
22 'css/helloplus-hero': path.resolve( modulesDir, 'content/assets/scss', 'hello-plus-hero.scss' ),
23 'css/helloplus-cta': path.resolve( modulesDir, 'content/assets/scss', 'hello-plus-cta.scss' ),
24 'css/helloplus-flex-hero': path.resolve( modulesDir, 'content/assets/scss', 'hello-plus-flex-hero.scss' ),
25 'css/helloplus-contact': path.resolve( modulesDir, 'content/assets/scss', 'hello-plus-contact.scss' ),
26 'js/helloplus-zigzag-fe': path.resolve( modulesDir, 'content/assets/js/frontend', 'hello-plus-zigzag-fe.js' ),
27 'css/helloplus-control-choose-img': path.resolve( modulesDir, 'content/assets/scss', 'choose-img.scss' ),
28 'js/helloplus-control-choose-img': path.resolve( modulesDir, 'content/assets/js', 'editor.js' ),
29
30 // Template Parts module
31 'css/helloplus-template-parts-editor': path.resolve( modulesDir, 'template-parts/assets/scss', 'editor.scss' ),
32 'css/helloplus-header': path.resolve( modulesDir, 'template-parts/assets/scss', 'hello-plus-header.scss' ),
33 'css/helloplus-footer': path.resolve( modulesDir, 'template-parts/assets/scss', 'hello-plus-footer.scss' ),
34 'css/helloplus-flex-footer': path.resolve( modulesDir, 'template-parts/assets/scss', 'hello-plus-flex-footer.scss' ),
35 'js/helloplus-header-fe': path.resolve( modulesDir, 'template-parts/assets/js', 'frontend.js' ),
36 'js/helloplus-editor': path.resolve( modulesDir, 'template-parts/assets/js', 'editor.js' ),
37
38 // Forms module
39 'css/helloplus-forms': path.resolve( modulesDir, 'forms/assets/scss/widgets', 'hello-plus-forms.scss' ),
40 'js/helloplus-forms-editor': path.resolve( modulesDir, 'forms/assets/js', 'editor.js' ),
41 'js/helloplus-forms-fe': path.resolve( modulesDir, 'forms/assets/js/frontend', 'frontend.js' ),
42
43 // Classes
44 'css/helloplus-button': path.resolve( devDir, 'scss', 'ehp-button.scss' ),
45 'css/helloplus-image': path.resolve( devDir, 'scss', 'ehp-image.scss' ),
46 'css/helloplus-shapes': path.resolve( devDir, 'scss', 'ehp-shapes.scss' ),
47 'css/helloplus-column-structure': path.resolve( devDir, 'scss', 'ehp-column-structure.scss' ),
48 };
49
50 module.exports = {
51 ...defaultConfig,
52 ...{
53 entry: entryPoints,
54 output: {
55 ...defaultConfig.output,
56 path: path.resolve( __dirname, './assets' ),
57 },
58 plugins: [
59 // Include WP's plugin config.
60 ...defaultConfig.plugins,
61
62 new CopyWebpackPlugin( {
63 patterns: [
64 {
65 from: path.resolve( modulesDir, 'content/assets/images' ),
66 to: imagesPath,
67 },
68 {
69 from: path.resolve( modulesDir, 'forms/assets/images' ),
70 to: imagesPath,
71 },
72 {
73 from: path.resolve( modulesDir, 'template-parts/assets/images' ),
74 to: imagesPath,
75 },
76 {
77 from: path.resolve( devDir, 'images' ),
78 to: imagesPath,
79 },
80 ],
81 } ),
82
83 // Removes the empty `.js` files generated by webpack but
84 // sets it after WP has generated its `*.asset.php` file.
85 new RemoveEmptyScriptsPlugin( {
86 stage: RemoveEmptyScriptsPlugin.STAGE_AFTER_PROCESS_PLUGINS,
87 } ),
88 ],
89 },
90 };
91