Skip to content

Commit c2cb8be

Browse files
committed
Merge branch 'latest' into webpackv4beta
2 parents 210b690 + 0d6846c commit c2cb8be

2 files changed

Lines changed: 92 additions & 29 deletions

File tree

.travis.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
language: node_js
22

33
node_js:
4-
- node
5-
- 6
4+
- lts/*
5+
6+
cache:
7+
directories:
8+
- "node_modules"
9+
10+
install:
11+
- yarn
12+
13+
script:
14+
- yarn webpack:version
15+
- yarn patternlab:build
16+
17+
deploy:
18+
provider: pages
19+
skip-cleanup: true
20+
github-token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable
21+
keep-history: true
22+
local-dir: public
23+
on:
24+
branch: master
625

726
branches:
827
only:
928
- master
1029
- latest
11-

readme.md

Lines changed: 71 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
[![Apache V2 License](http://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/Comcast/patternlab-edition-node-webpack/blob/master/LICENSE)
22

3-
43
# Pattern Lab Node - Webpack Edition
4+
55
The webpack wrapper around [Pattern Lab Node Core](https://github.com/pattern-lab/patternlab-node) providing tasks to interact with the core library and move supporting frontend assets.
66

77
## Packaged Components
88

99
The webpack edition comes with the following components:
1010

11-
* `patternlab-node`: [GitHub](https://github.com/pattern-lab/patternlab-node), [npm](https://www.npmjs.com/package/patternlab-node)
12-
* `patternengine-node-mustache`: [GitHub](https://github.com/pattern-lab/patternengine-node-mustache), [npm](https://www.npmjs.com/package/patternengine-node-mustache)
13-
* `pattern-lab/styleguidekit-assets-default`: [GitHub](https://github.com/pattern-lab/styleguidekit-assets-default)
14-
* `pattern-lab/styleguidekit-mustache-default`: [GitHub](https://github.com/pattern-lab/styleguidekit-mustache-default)
11+
- `patternlab-node`: [GitHub](https://github.com/pattern-lab/patternlab-node), [npm](https://www.npmjs.com/package/patternlab-node)
12+
- `patternengine-node-mustache`: [GitHub](https://github.com/pattern-lab/patternengine-node-mustache), [npm](https://www.npmjs.com/package/patternengine-node-mustache)
13+
- `pattern-lab/styleguidekit-assets-default`: [GitHub](https://github.com/pattern-lab/styleguidekit-assets-default)
14+
- `pattern-lab/styleguidekit-mustache-default`: [GitHub](https://github.com/pattern-lab/styleguidekit-mustache-default)
1515

1616
## Prerequisites
1717

1818
The Pattern Lab Node - webpack edition uses [Node](https://nodejs.org/en/) for core processing, [npm](https://www.npmjs.com/) to manage project dependencies, and [webpack.io](https://webpack.github.io/) to run tasks and interface with the core library. Node version 4 or higher suffices. You can follow the directions for [installing Node](https://nodejs.org/en/download/) on the Node website if you haven't done so already. Installation of Node will include npm.
1919

2020
## Quickstart Guide
21+
2122
_Note: You must have all of the prerequisites first_
2223

23-
1. Download the `.zip` or fork this repository, then clone it locally.
24+
1. Download the `.zip` or fork this repository, then clone it locally.
2425
> `git clone git@github.com:YOURGROUP/patternlab-edition-node-webpack.git`
25-
1. In a terminal window, navigate to the downloaded directory
26+
1. In a terminal window, navigate to the downloaded directory
2627
> `cd path/to/patternlab-edition-node-webpack`
27-
1. To populate Patternlab with sample data, install a starter kit, there are many [starterkits](https://github.com/pattern-lab?utf8=%E2%9C%93&q=starterkit&type=&language=) choose from
28+
1. To populate Patternlab with sample data, install a starter kit, there are many [starterkits](https://github.com/pattern-lab?utf8=%E2%9C%93&q=starterkit&type=&language=) choose from
2829
> `npm install starterkit-mustache-demo`
29-
1. Generate sample files
30+
1. Generate sample files
3031
> `npm run patternlab:loadstarterkit --kit=starterkit-mustache-demo`
31-
1. Show Patternlab in a Webbrowser
32+
1. Show Patternlab in a Webbrowser
3233
> `npm run patternlab:serve`
3334
3435
## Installing
@@ -37,24 +38,24 @@ _Note: You must have all of the prerequisites first_
3738

3839
### What's Included
3940

40-
The pre-built project comes with the [Base Starterkit for Mustache](https://github.com/pattern-lab/starterkit-mustache-base) installed by default.
41+
The pre-built project comes with the [Base Starterkit for Mustache](https://github.com/pattern-lab/starterkit-mustache-base) installed by default.
4142

4243
**Please note:** Pattern Lab Node uses [npm](https://www.npmjs.com/) to manage project dependencies. To upgrade the webpack edition or to install plug-ins you'll need to be familiar with npm.
4344

4445
### Use npm
4546

4647
`npm` is a dependency management and package system which can pull in all of the webpack editions's dependencies for you. To accomplish this:
4748

48-
* download or `git clone` this repository to an install location.
49+
- download or `git clone` this repository to an install location.
4950

50-
* run the following
51+
- run the following
5152

5253
```
5354
cd install/location
5455
npm install
5556
```
5657
57-
Running `npm install` from a directory containing a `package.json` file will download all dependencies defined within. The `package-lock.json` file is automatically managaged everytime you add/remove/upgrade a dependency.
58+
Running `npm install` from a directory containing a `package.json` file will download all dependencies defined within. The `package-lock.json` file is automatically managaged everytime you add/remove/upgrade a dependency.
5859
5960
#### Install the Webpack Edition of Pattern Lab Node as a Dependency
6061
@@ -91,7 +92,7 @@ To generate the front-end for Pattern Lab type:
9192
9293
### Watch for changes and re-generate Pattern Lab
9394
94-
To watch for changes, re-generate the front-end, and server it via a BrowserSync server, type:
95+
To watch for changes, re-generate the front-end, and server it via a BrowserSync server, type:
9596
9697
npm run patternlab:serve
9798
@@ -109,35 +110,79 @@ To install a specific StarterKit from GitHub type:
109110
110111
Unlike the other editions, there were a few options added just for this edition that allow for easier upgrading, and better flexibility.
111112
112-
#### Setting Dev Server Settings
113-
You can set the url and port number in the configuration for
113+
#### Setting Webpack Dev Server
114+
115+
You can set several options to configure your dev server. You can also in the CLI pass any option on demand.
114116
115-
"server": {
117+
```javascript
118+
"webpackDevServer": {
116119
"url": "http://localhost",
117-
"port": 3000
120+
"port": 3000,
121+
"watchContentBase": true,
122+
"watchOptions": {
123+
"aggregateTimeout": 500,
124+
"ignored": [],
125+
"info-verbosity": "verbose"
126+
}
118127
},
128+
```
119129

120130
#### Setting the Webpack Merge Options
131+
121132
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)
122133

123134
You can change how it merges by changing this object in `patternlab-config.json`:
124-
135+
136+
```javascript
125137
"webpackMerge": {
126-
"entry":"replace"
138+
"entry": "replace"
127139
},
128-
140+
```
129141
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)
130142

143+
#### Modifying the compression settings for bundles
144+
145+
You can safely modify the following settings in the the main `webpack.babel.config` that can change how the bundles get optimized.
146+
147+
_Note: in webpack 4, these settings are automatically triggered when `mode=production` when running the dev server this is not used._
148+
149+
All uglify settings are in the`patternlab-config.json`:
150+
151+
```javascript
152+
"uglify": {
153+
"sourceMap": false,
154+
"parallel": true,
155+
"uglifyOptions": {
156+
"mangle": false
157+
}
158+
},
159+
```
160+
#### Namespace
161+
In some cases you may want to add a namespace to your JS or CSS/SCSS files. You can now add a global `NAMESPACE` which can be read by any JS module. The sample of .scss includes how to use it in a `.SCSS` file.
162+
163+
This can be changed in the`patternlab-config.json` under `app`:
164+
165+
```javascript
166+
"app": {
167+
"namespace": ""
168+
}
169+
```
170+
171+
131172
### Licenses
173+
* [babel-cli](https://github.com/babel/babel/blob/master/LICENSE) - MIT
132174
* [babel-core](https://github.com/babel/babel/blob/master/LICENSE) - MIT
133-
* [babel-loader](https://github.com/babel/babel-loader/blob/master/LICENSE) -MIT,
175+
* [babel-polyfill](https://github.com/babel/babel-loader/blob/master/LICENSE) -MIT
176+
* [babel-loader](https://github.com/babel/babel-loader/blob/master/LICENSE) -MIT
134177
* [babel-preset-env](https://github.com/babel/babel/blob/master/LICENSE) - MIT
178+
* [babel-register](https://github.com/babel/babel-loader/blob/master/LICENSE) -MIT
135179
* [copy-webpack-plugin](https://github.com/webpack-contrib/copy-webpack-plugin/blob/master/LICENSE) - MIT
136180
* [event-hooks-webpack-plugin](https://github.com/cascornelissen/event-hooks-webpack-plugin/blob/master/LICENSE.md) - MIT
137181
* [globby](https://github.com/sindresorhus/globby/blob/master/license) - MIT
138182
* [patternlab-node](https://github.com/pattern-lab/patternlab-node/blob/master/LICENSE) - MIT
139183
* [styleguidekit-assets-default](https://github.com/pattern-lab/styleguidekit-assets-default/blob/master/LICENSE) - MIT
140184
* [styleguidekit-mustache-default](https://github.com/pattern-lab/styleguidekit-mustache-default/blob/master/LICENSE) - MIT
185+
* [uglifyjs-webpack-plugin](https://github.com/webpack-contrib/uglifyjs-webpack-plugin/blob/master/LICENSE) - MIT
141186
* [webpack](https://github.com/webpack/webpack/blob/master/LICENSE) - MIT
142187
* [webpack-config-utils](https://github.com/kentcdodds/webpack-config-utils/blob/master/LICENSE) - MIT
143188
* [webpack-dev-server](https://github.com/webpack/webpack-dev-server/blob/master/LICENSE) - MIT
@@ -147,6 +192,6 @@ By default merge does a `append` if that option works for you only set which web
147192

148193
| | | |
149194
----------- | :-------------- | :-- |
150-
| ![@Josh68](https://avatars2.githubusercontent.com/u/771447?s=460&v=4)| **Josh Schneider** | [GitHub](https://github.com/Josh68)
151-
| ![@paintedbicycle](https://avatars3.githubusercontent.com/u/371114?s=75&v=4)| **Paul Wright** | [Website](https://paintedbicycle.com)
152-
| ![@rgualberto](https://avatars3.githubusercontent.com/u/5126167?v=4&s=75) | **Rodrigo Gualberto** | [GitHub](https://github.com/rgualberto)
195+
| ![@Josh68](https://avatars2.githubusercontent.com/u/771447?s=75&v=4)| **Josh Schneider** | [GitHub](https://github.com/Josh68)
196+
| ![@paintedbicycle](https://avatars3.githubusercontent.com/u/371114?s=75&v=4)| **Paul Wright** | [Website](https://paintedbicycle.com)
197+
````

0 commit comments

Comments
 (0)