Skip to content

Commit 3b66cd4

Browse files
authored
Merge pull request #29 from Josh68/webpackv4beta
Documentation and configuration updates
2 parents 44ae0f9 + 25a9f6b commit 3b66cd4

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

readme.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@ To install a specific StarterKit from GitHub type:
110110
111111
Unlike the other editions, there were a few options added just for this edition that allow for easier upgrading, and better flexibility.
112112
113+
#### Custom Webpack Configuration and Merge Options
114+
115+
In this edition, it's important to make the configuration for webpack something very easy to update, and very easy to modify. The current setting for webpack custom configuration and merge are described [here.](https://github.com/Comcast/patternlab-edition-node-webpack/blob/master/source/_app/readme.md)
116+
117+
You can change how it merges by changing this object in `patternlab-config.json`:
118+
119+
```javascript
120+
"webpackMerge": {
121+
"entry": "replace"
122+
},
123+
```
124+
By default merge does a `append` if that option works for you only set which webpack configuration you want to change. The merge setting is: `smartStrategy` which is documented over on this [page.](https://www.npmjs.com/package/webpack-merge#mergesmartstrategy-key-prependappendreplaceconfiguration--configuration)
125+
113126
#### Setting Webpack Dev Server
114127

115128
You can set several options to configure your dev server. You can also in the CLI pass any option on demand.
@@ -126,27 +139,13 @@ You can set several options to configure your dev server. You can also in the CL
126139
}
127140
},
128141
```
129-
130-
#### Setting the Webpack Merge Options
131-
132-
In this edition, it's important to make the configuration for webpack something very easy to update, and very easy to modify. The current setting for webpack merge are described [here.](https://github.com/Comcast/patternlab-edition-node-webpack/blob/master/source/_app/readme.md)
133-
134-
You can change how it merges by changing this object in `patternlab-config.json`:
135-
136-
```javascript
137-
"webpackMerge": {
138-
"entry": "replace"
139-
},
140-
```
141-
By default merge does a `append` if that option works for you only set which webpack configuration you want to change. The merge setting is: `smartStrategy` which is documented over on this [page.](https://www.npmjs.com/package/webpack-merge#mergesmartstrategy-key-prependappendreplaceconfiguration--configuration)
142-
143142
#### Modifying the compression settings for bundles
144143

145144
You can safely modify the following settings in the the main `webpack.babel.config` that can change how the bundles get optimized.
146145

147146
_Note: in webpack 4, these settings are automatically triggered when `mode=production` when running the dev server this is not used._
148147

149-
All uglify settings are in the`patternlab-config.json`:
148+
All uglify settings are in the `patternlab-config.json`:
150149

151150
```javascript
152151
"uglify": {
@@ -167,8 +166,6 @@ This can be changed in the`patternlab-config.json` under `app`:
167166
"namespace": ""
168167
}
169168
```
170-
171-
172169
### Licenses
173170
* [babel-cli](https://github.com/babel/babel/blob/master/LICENSE) - MIT
174171
* [babel-core](https://github.com/babel/babel/blob/master/LICENSE) - MIT

source/_app/readme.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ Used to store your app specific files.
66

77
**Custom Webpack Configuration**
88

9-
`webpack.app.js` this file is used to place your custom webpack configuration. This will merge or override the values in `webpack.config.babel.js` This will provide a way to change your configuration and still get updates in the future.
9+
The file `/source/_app/webpack.app.js` is your custom webpack configuration. This will merge or override the values in `webpack.config.babel.js`. This will provide a way to change your configuration and still get updates in the future.
10+
11+
**Sample Custom Configuration**
12+
13+
This edition includes [an example configuration](https://github.com/Comcast/patternlab-edition-node-webpack/blob/latest/source/_app/samples/scss/webpack.app.js) for loading, processing, and bundling SASS/SCSS. Use this sample as a template and modify as you like for working with any project asset-types.
1014

1115
### More information
1216

source/_app/samples/scss/webpack.app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
2-
* NOTE: THIS IS A SAMPLE, THIS SHOULD BE webpack.app.js one level higher to be used in your project.
2+
* NOTE: THIS IS A SAMPLE.
3+
* Any configuration to be merged with 'webpack.config.babel.js' SHOULD BE ADDED TO '/source/_app/webpack.app.js'.
34
* Add new dependencies like so:
45
* "yarn add autoprefixer import-glob-loader css-loader node-sass postcss-loader postcss-flexbugs-fixes mini-css-extract-plugin sass-loader style-loader --dev"
56
* or

webpack.config.babel.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ module.exports = env => {
110110

111111
// additional watch files
112112
const watchFiles = [
113-
`${plConfig.paths.source.patterns}**/*.json`,
114-
`${plConfig.paths.source.patterns}**/*.md`,
115-
`${plConfig.paths.source.data}**/*.json`,
113+
`${plConfig.paths.source.patterns}**/*.(json|md|yaml|yml)`,
114+
`${plConfig.paths.source.data}**/*.(json|md|yaml|yml)`,
116115
`${plConfig.paths.source.fonts}**/*`,
117116
`${plConfig.paths.source.images}**/*`,
118117
`${plConfig.paths.source.meta}**/*`,
@@ -156,7 +155,7 @@ module.exports = env => {
156155
hot: true,
157156
watchContentBase: plConfig.app.webpackDevServer.watchContentBase,
158157
watchOptions: plConfig.app.webpackDevServer.watchOptions
159-
},
158+
},
160159
module: {
161160
rules: [
162161
{

0 commit comments

Comments
 (0)