Skip to content

Commit 736a719

Browse files
authored
Merge pull request #215 from webpack/develop
Deploy
2 parents 426bb8b + 94003a7 commit 736a719

19 files changed

+142
-48
lines changed

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
"presets": [
33
"es2015",
44
"react"
5+
],
6+
"plugins": [
7+
"syntax-object-rest-spread",
8+
"transform-object-rest-spread"
59
]
610
}

.eslintrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
"plugins": [
1313
"markdown"
1414
],
15-
15+
16+
"globals": {
17+
"__DEV__": true
18+
},
19+
1620
"rules": {
1721
"no-undef": 2,
1822
"no-unreachable": 2,

antwar.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = {
6868
function() {
6969
return require.context(
7070
'json!yaml-frontmatter!./content/how-to',
71-
false,
71+
true,
7272
/^\.\/.*\.md$/
7373
);
7474
}

components/Link.jsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import React from 'react';
2-
import {Link as RRLink} from 'react-router';
32

4-
const Link = props => <RRLink {...props} />;
3+
let RRouter;
4+
if (__DEV__) {
5+
RRouter = require('react-router');
6+
}
7+
8+
const Link = ({ to, ...props }) => {
9+
if (__DEV__) {
10+
return <RRouter.Link to={to} {...props} />;
11+
}
12+
13+
return <a href={to} {...props} />;
14+
};
515

616
export default Link;

components/Navigation.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default ({ home = '/', pages, onToggleNav }) => (
77
<div className="navigation">
88
<Container>
99
<div className="navigation__inner">
10-
<button className="navigation__mobilebtn" onClick={onToggleNav}>
10+
<button id="menu-btn" className="navigation__mobilebtn" onClick={onToggleNav}>
1111
Open navigation
1212
</button>
1313
<Link className="navigation__logo" to={{ pathname: home }}>

components/Page.jsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
import React from 'react';
2+
import Interactive from 'antwar-interactive';
23
import Container from './Container';
34
import Sidebar from './Sidebar';
45
import Contributors from './Contributors';
56

6-
export default props => {
7-
let { config, section, page } = props;
8-
7+
export default ({ section, page }) => {
98
let edit = `https://github.com/webpack/webpack.js.org/edit/master/content/${page.url}.md`;
109

1110
return (
1211
<Container className="page">
13-
<Sidebar paths={config.paths} sectionName={section.name} pages={ section.pages() } />
12+
<Interactive
13+
id="components/Sidebar.jsx"
14+
component={Sidebar}
15+
sectionName={section.name}
16+
pages={section.pages().map(page => ({
17+
url: page.url,
18+
title: page.title,
19+
anchors: page.anchors
20+
}))}
21+
/>
22+
1423
<section className="page__content">
1524
<h1>{ page.title }</h1>
1625

components/Sidebar.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component } from 'react';
1+
import React from 'react';
22
import Link from './Link';
33

44
const Sidebar = ({ sectionName, pages }) => {
@@ -22,7 +22,7 @@ const Sidebar = ({ sectionName, pages }) => {
2222
);
2323
};
2424

25-
class Item extends Component {
25+
class Item extends React.Component {
2626
constructor(props) {
2727
super(props);
2828

@@ -35,12 +35,11 @@ class Item extends Component {
3535
let { index, url, title, anchors = [] } = this.props;
3636
let emptyMod = !anchors.length ? 'sidebar-item--empty' : '';
3737
let openMod = this.state.open ? 'sidebar-item--open' : '';
38-
38+
3939
return (
4040
<div className={ `sidebar-item ${emptyMod} ${openMod}` }>
4141
<Link className="sidebar-item__title" to={ url }>{ title }</Link>
42-
<i className="sidebar-item__toggle icon-chevron-down"
43-
onClick={ this.toggle.bind(this) } />
42+
<i className="sidebar-item__toggle icon-chevron-down" onClick={ this.toggle.bind(this) } />
4443
<ul className="sidebar-item__anchors">
4544
{
4645
anchors.map((anchor, j) => (

components/Site.jsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,19 @@ export default class Site extends React.Component {
2020
navDisplayed: false
2121
};
2222

23-
this.onToggleNav = () => {
24-
this.setState({navDisplayed: !this.state.navDisplayed});
25-
};
26-
}
27-
28-
componentWillUpdate (nextProps) {
29-
console.log(nextProps);
23+
// this.onToggleNav = () => {
24+
// this.setState({navDisplayed: !this.state.navDisplayed});
25+
// };
3026
}
3127

3228
render () {
3329
let { children } = this.props;
3430

35-
const cls = this.state.navDisplayed ? 'site nav-displayed' : 'site';
31+
// TODO: restore
32+
// const cls = this.state.navDisplayed ? 'site nav-displayed' : 'site';
3633

3734
return (
38-
<div className={cls}>
35+
<div id="site" className="site">
3936
<Navigation home="/" pages={ pages } onToggleNav={this.onToggleNav} />
4037
<Sidecar />
4138
{ children }

content/how-to/develop.md

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
11
---
22
title: How to Develop?
3+
contributors:
4+
- SpaceK33z
35
---
4-
> devtool
5-
> output.pathinfo
6-
> hot module replacement
7-
8-
> watch
9-
> caching
10-
> dev middleware
11-
> in memory compilation
12-
> dev server
6+
7+
- Show the three ways to develop: webpack --watch, webpack-dev-server, webpack-dev-middleware and explain the differences (keep it short!). dev-server is the easiest one to get started.
8+
- dev-server and dev-middleware use in-memory compilation
9+
10+
W> Explain that IT SHOULD NOT BE USED IN PRODUCTION, NEVER.
11+
12+
Adjusting your text editor
13+
14+
- Explain that some editors use "atomic save"; this needs to be disabled in order to see all file changes.
15+
16+
Choose a devtool
17+
18+
- Explain shortly what source maps are and why they come in handy when devving
19+
- Link to devtool page for more info about source maps
20+
21+
webpack watch mode
22+
23+
- show one use case
24+
- show how to use in CLI
25+
- show how to use API
26+
- explain that you need to use your own server (maybe show the python server)
27+
28+
webpack-dev-server
29+
30+
- show one use case
31+
- how to install
32+
- show how to use in CLI
33+
- show how to use API
34+
- refer to `devServer` configuration page
35+
- explain `inline` and `iframe` mode, and explain `inline` requires more config in API
36+
- make clear that there are some differences in CLI and API
37+
- after explaining live reload, link to HMR article
38+
39+
webpack-dev-middleware
40+
41+
- show one use case
42+
- how to install
43+
- show how to use API
44+
- refer to `devServer` configuration page
45+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: How to Develop Using Docker?
3+
---
4+
5+
# What is docker
6+

0 commit comments

Comments
 (0)