Skip to content

Commit 43daab4

Browse files
authored
Merge branch 'master' into patch-1
2 parents 98c7506 + 6a54622 commit 43daab4

26 files changed

+78
-77
lines changed

components/page/page-style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
.page > div:first-of-type {
1313
flex: 0 0 auto;
1414
position: relative;
15+
overflow: hidden;
1516

1617
@include break {
1718
flex:0 0 30%;

components/sidebar/sidebar-style.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
@import 'mixins';
33

44
.sidebar {
5-
position: absolute;
65
display: none;
76
width: 100%;
87
max-height: 100%;

components/sidebar/sidebar.jsx

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,25 @@ export default class Sidebar extends Component {
77

88
this.state = {
99
fixed: false,
10-
top: 0
10+
extraHeight: null,
11+
maxWidth: null
1112
};
1213
}
1314

14-
componentDidMount() {
15-
document.addEventListener('scroll', this._recalculate.bind(this));
16-
}
17-
18-
componentWillUnmount() {
19-
document.removeEventListener('scroll', this._recalculate.bind(this));
20-
}
21-
22-
/**
23-
* Re-calculate fixed state and position
24-
*
25-
*/
26-
_recalculate() {
27-
let { scrollY, innerHeight } = window;
28-
let { scrollHeight } = document.body;
29-
let { offsetHeight } = this._container;
30-
let distToBottom = scrollHeight - scrollY - innerHeight;
31-
let headerHeight = document.querySelector('header').offsetHeight;
32-
let footerHeight = document.querySelector('footer').offsetHeight;
33-
let allowedHeight = distToBottom < footerHeight ? innerHeight - (footerHeight - distToBottom) : offsetHeight;
34-
let extraHeight = offsetHeight > allowedHeight ? offsetHeight - allowedHeight : 0;
35-
let fixed = scrollY >= headerHeight;
36-
37-
this.setState({
38-
fixed,
39-
top: scrollY - headerHeight - extraHeight
40-
});
41-
}
42-
4315
render() {
4416
let { sectionName, pages, currentPage } = this.props;
45-
let { fixed, top, allowedHeight } = this.state;
17+
let { fixed, extraHeight, maxWidth } = this.state;
4618
let isGuides = sectionName === 'guides';
4719

4820
return (
4921
<nav
5022
className="sidebar"
5123
ref={ ref => this._container = ref }
5224
style={ fixed ? {
53-
top: top
25+
position: 'fixed',
26+
top: -extraHeight,
27+
width: maxWidth,
28+
maxHeight: 'none'
5429
} : null }>
5530

5631
<div className="sidebar__inner">
@@ -79,4 +54,39 @@ export default class Sidebar extends Component {
7954
</nav>
8055
);
8156
}
57+
58+
componentDidMount() {
59+
document.addEventListener(
60+
'scroll',
61+
this._recalculate.bind(this)
62+
);
63+
}
64+
65+
componentWillUnmount() {
66+
document.removeEventListener(
67+
'scroll',
68+
this._recalculate.bind(this)
69+
);
70+
}
71+
72+
/**
73+
* Re-calculate fixed state and position
74+
*
75+
*/
76+
_recalculate() {
77+
let { scrollY, innerHeight } = window;
78+
let { scrollHeight } = document.body;
79+
let { offsetHeight: sidebarHeight } = this._container;
80+
let { offsetWidth: parentWidth, offsetHeight: parentHeight } = this._container.parentNode;
81+
let headerHeight = document.querySelector('header').offsetHeight;
82+
let footerHeight = document.querySelector('footer').offsetHeight;
83+
let distToBottom = scrollHeight - scrollY - innerHeight;
84+
let availableSpace = innerHeight + distToBottom - footerHeight;
85+
86+
this.setState({
87+
fixed: scrollY >= headerHeight && sidebarHeight < parentHeight,
88+
extraHeight: sidebarHeight > availableSpace ? sidebarHeight - availableSpace : 0,
89+
maxWidth: parentWidth
90+
});
91+
}
8292
}

content/configuration/stats.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ stats: {
5252
chunksSort: "field",
5353
// Context directory for request shortening
5454
context: "../src/",
55+
// `webpack --colors` equivalent
56+
colors: true,
5557
// Add errors
5658
errors: true,
5759
// Add details to errors (like resolving log)

content/guides/author-libraries.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
title: Authoring Libraries
3-
sort: 18
43
contributors:
54
- pksjce
65
- johnstew

content/guides/build-performance.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
title: Improving Build Performance
3-
sort: 15
43
---
54

65
?> incremental builds

content/guides/caching.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Caching
3-
sort: 16
3+
sort: 41
44
contributors:
55
- okonet
66
- jouni-kantola
@@ -153,7 +153,7 @@ To generate identifiers that are preserved over builds, webpack supply the `Name
153153

154154
> TODO: When exist, link to `NamedModulesPlugin` and `HashedModuleIdsPlugin` docs pages
155155
156-
> TODO: Describe how the option `recordsPath` option works
156+
> TODO: Describe how the option `recordsPath` option works
157157
158158
The chunk manifest (along with bootstrapping/runtime code) is then placed into the entry chunk and it is crucial for webpack-packaged code to work.
159159

content/guides/code-splitting-css.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Code Splitting - CSS
3-
sort: 3
3+
sort: 31
44
contributors:
55
- pksjce
66
- jonwheeler

content/guides/code-splitting-libraries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Code Splitting - Libraries
3-
sort: 4
3+
sort: 32
44
contributors:
55
- pksjce
66
- chrisVillanueva

content/guides/code-splitting-require.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Code Splitting - Using require.ensure
3-
sort: 5
3+
sort: 33
44
contributors:
55
- pksjce
66
- rahulcs

content/guides/code-splitting.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Code Splitting
3-
sort: 2
3+
sort: 30
44
contributors:
55
- pksjce
66
- pastelsky
@@ -16,13 +16,13 @@ There are mainly two kinds of code splitting that can be accomplished with webpa
1616

1717
A typical application can depend on many third party libraries for framework/functionality needs. Unlike application code, code present in these libraries does not change often.
1818

19-
If we keep code from these libraries in its own bundle, separate from the application code, we can leverage the browser's caching mechanism to cache these files for longer durations on the end user's machine.
19+
If we keep code from these libraries in its own bundle, separate from the application code, we can leverage the browser's caching mechanism to cache these files for longer durations on the end user's machine.
2020

2121
For this to work, the `hash` portion in the vendor filename must remain constant, regardless of application code changes. Learn [how to split vendor/library](/guides/code-splitting-libraries) code using the CommonsChunkPlugin.
2222

2323
### CSS splitting
2424

25-
You might also want to split your styles into a separate bundle, independent from application logic.
25+
You might also want to split your styles into a separate bundle, independent from application logic.
2626
This enhances cacheability of your styles and allows the browser to load the styles in-parallel with your application code, thus preventing a FOUC (flash of unstyled content).
2727

2828
Learn [how to split css](/guides/code-splitting-css) using the `ExtractTextWebpackPlugin`.
@@ -39,5 +39,3 @@ This can be used for more granular chunking of code, for example, per our applic
3939
Learn [how to split code](/guides/code-splitting-require) using `require.ensure()`.
4040

4141
?> Document `System.import()`
42-
43-

content/guides/compatibility.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
title: Handling Compatibility
3-
sort: 11
43
---
54

65
?> require.main

content/guides/dependency-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Dependency Management
3-
sort: 6
3+
sort: 60
44
contributors:
55
- ndelangen
66
- chrisVillanueva

content/guides/development-third-party.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

content/guides/development-vagrant.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Development - Vagrant
3-
sort: 12
3+
sort: 51
44
contributors:
55
- SpaceK33z
66
- chrisVillanueva

content/guides/development.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Development
3-
sort: 9
3+
sort: 50
44
contributors:
55
- SpaceK33z
66
- rafde
@@ -73,11 +73,11 @@ to continue editing and saving your changes from Chrome or source files.
7373

7474
There are some _gotchas_ about using workspaces with watch:
7575

76-
- Large chunks (such as a common chunk that is over 1MB) that are rebuilt could cause the page to blank,
76+
- Large chunks (such as a common chunk that is over 1MB) that are rebuilt could cause the page to blank,
7777
which will force you to refresh the browser.
78-
- Smaller chunks will be faster to build than larger chunks since `inline-source-map` is slower
78+
- Smaller chunks will be faster to build than larger chunks since `inline-source-map` is slower
7979
due to having to base64 encode the original source code.
80-
80+
8181
### webpack-dev-server
8282

8383
webpack-dev-server provides you with a server and live reloading. This is easy to setup.

content/guides/hmr-react.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
title: Hot Module Replacement - React
3-
sort: 8
43
contributors:
54
- jmreidy
65
- jhnns
@@ -228,11 +227,11 @@ The important thing to note in the code above is the `module` reference.
228227
2. Thus we can use the `module.hot` hook to enable HMR for specific resources (Here's `App.js`). The most important API here is `module.hot.accept`, which specifies how to handle changes to specific dependencies.
229228

230229
3. Note that because webpack 2 has built-in support for ES2015 modules, you won't need to re-require your root component in `module.hot.accept`. To make this work, you need to change the Babel ES2015 preset in `.babelrc` to be:
231-
230+
232231
```
233232
["es2015", {"modules": false}]
234233
```
235-
234+
236235
like what we did in [Babel Config](#babel-config). Note that disabling Babel's module plugin is not only necessary for HMR. If you don't disable it you'll run into many other issues (see [Migrating from v1 to v2](/guides/migrating/#mixing-es2015-with-amd-and-commonjs) and [webpack-tree-shaking](http://www.2ality.com/2015/12/webpack-tree-shaking.html)).
237236

238237
4. Note that if you're using ES6 modules in your webpack 2 configuration file, and you change your `.babelrc` file in #3 above, you either need to use `require` or create two `.babelrc` files (issue [here](https://github.com/webpack/webpack.js.org/issues/154)):

content/guides/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ contributors:
44
- pksjce
55
- bebraw
66
- simon04
7-
sort: 1
7+
sort: 10
88
---
99

1010
### Pre-requisites

content/guides/lazy-load-react.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
title: Lazy Loading - React
3-
sort: 14
43
contributors:
54
- iammerrick
65
- chrisVillanueva

content/guides/migrating.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Migrating from v1 to v2
3-
sort: 19
3+
sort: 20
44
contributors:
55
- sokra
66
- jhnns
@@ -269,8 +269,8 @@ module: {
269269
test: /.css$/,
270270
- loader: ExtractTextPlugin.extract("style-loader", "css-loader", { publicPath: "/dist" })
271271
+ loader: ExtractTextPlugin.extract({
272-
+ fallbackLoader: "style-loader",
273-
+ loader: "css-loader",
272+
+ fallback: "style-loader",
273+
+ use: "css-loader",
274274
+ publicPath: "/dist"
275275
+ })
276276
]

content/guides/production-build.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Building for Production
3-
sort: 13
3+
sort: 40
44
contributors:
55
- henriquea
66
- rajagopal4890

content/guides/public-path.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
title: Public Path
3-
sort: 14
43
contributors:
54
- rafaelrinaldi
65
- chrisVillanueva

content/guides/shimming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Shimming
3-
sort: 17
3+
sort: 61
44
contributors:
55
- pksjce
66
- jhnns

content/guides/task-test-runner.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Integration with ask/test runners
3+
---
4+
5+
?> Grunt
6+
7+
?> Gulp
8+
9+
?> Mocha
10+
11+
?> Karma

content/guides/webpack-and-typescript.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
title: webpack & Typescript
3-
sort: 20
43
contributors:
54
- morsdyce
65
---

content/guides/why-webpack.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ contributors:
55
- bebraw
66
- chrisVillanueva
77
- tashian
8-
sort: 2
98
---
109

1110
webpack is a module bundler, like Browserify or Brunch. It is not a task runner. Make, Grunt, or Gulp are task runners. But people get confused about the difference, so let's clear that up right away.

0 commit comments

Comments
 (0)