Skip to content

Commit cb8ecf7

Browse files
authored
Merge pull request webpack#3 from webpack-china/cn
merge from webpack-china
2 parents 139d369 + 1abd94d commit cb8ecf7

File tree

144 files changed

+4970
-2919
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+4970
-2919
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ npm-debug.log
33
build
44
# generated
55
.antwar
6+
.idea

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ node_js:
88
script:
99
- bash ./scripts/deploy.sh
1010
sudo: required
11+
cache: yarn
1112
install:
12-
- npm install
13+
- npm i yarn -g
14+
- yarn
1315
- sudo pip install proselint

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Issue the PR to the [master](https://github.com/webpack/webpack.js.org/tree/mast
4040
4141
## Contribution Recognition
4242

43-
Any document that you edit, you can choose to add your GitHub username at the top of the document for recognition:
43+
You can choose to add your GitHub username for recognition at the top of any markdown document you edit:
4444

4545
**example.md**
4646

@@ -59,7 +59,7 @@ contributors:
5959

6060
```
6161

62-
This will add your name and GitHub profile photo to the document in production. This is a great way to own the awesome work that you do and encourage that you remember to do this in your PR's.
62+
This will add your name and GitHub profile photo to the document in production. It's a great way to own the awesome work that you do and we encourage you to do this in your PRs.
6363

6464

6565
## Thank you

PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
1. [Read and sign the CLA](https://cla.js.foundation/webpack/webpack.js.org). This needs to be done only once. PRs that haven't signed it won't be accepted.
22
2. Make sure your PR complies with [the writer's guide](https://webpack.js.org/writers-guide/).
33
3. Read through the PR diff carefully as sometimes this can reveal issues. The work will be reviewed, but this can save some effort.
4+
4. Remove these instructions from your PR as they are for your eyes only.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# webpack 中文文档
22

3+
> https://doc.webpack-china.org webpack 中文文档
34
> https://webpack-china.org webpack 中文社区
45
56
- [webpack 2 翻译任务认领说明 - 入口目录](https://github.com/webpack-china/webpack.js.org/issues/17)

antwar.config.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,13 @@ module.exports = {
3838
}
3939
),
4040

41-
'get-started': section(
42-
'起步',
43-
function() {
44-
return require.context(
45-
'json-loader!yaml-frontmatter-loader!./content/get-started',
46-
false,
47-
/^\.\/.*\.md$/
48-
)
41+
'get-started': {
42+
redirects: {
43+
'': '/guides/get-started',
44+
'install-webpack': '/guides/installation',
45+
'why-webpack': '/guides/why-webpack',
4946
}
50-
),
47+
},
5148

5249
concepts: section(
5350
'概念',
@@ -71,6 +68,17 @@ module.exports = {
7168
}
7269
),
7370

71+
development: section(
72+
'开发',
73+
function() {
74+
return require.context(
75+
'json-loader!yaml-frontmatter-loader!./content/development',
76+
true,
77+
/^\.\/.*\.md$/
78+
);
79+
}
80+
),
81+
7482
configuration: section(
7583
'配置',
7684
function() {
@@ -137,7 +145,7 @@ module.exports = {
137145
return combineContexts(content, generated);
138146
}
139147
),
140-
148+
141149
vote: {
142150
path() {
143151
return require('./components/vote/list.jsx').default
@@ -166,7 +174,7 @@ module.exports = {
166174

167175
function root(contentCb) {
168176
return {
169-
title: 'Webpack',
177+
title: 'webpack',
170178
path: function() { // Load path content
171179
return contentCb();
172180
},
@@ -231,11 +239,9 @@ function combineContexts(context1, context2) {
231239
}
232240
}
233241
webpackContext.keys = () => {
234-
"use strict";
235-
236242
let keys1 = context1.keys();
237243
let keys2 = context2.keys();
238-
return _.chain(keys1).concat(keys2).uniq().value();
244+
return _.chain(keys1).concat(keys2).sortBy().uniq().value();
239245
};
240246
return webpackContext;
241247
}

assets/awesome-badge.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/icon-square-small-slack.png

14.5 KB
Loading

bootstrap.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ antwar[environment]({
1111
webpack: require('./webpack.config')
1212
}).catch(function (err) {
1313
console.error(err);
14+
15+
process.exit(1);
1416
});

components/cube/cube.jsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,22 @@ export default class Cube extends React.Component {
7878
let degrees = 0;
7979
let axis = 'y';
8080

81-
this._interval = setInterval(() => {
82-
let obj = {};
83-
obj[axis] = degrees += 90;
84-
85-
this.setState({ ...obj, iteration: (this.state.iteration + 1) % 4 });
86-
}, repeatDelay);
81+
let lastTime = performance.now();
82+
let animation = () => {
83+
let nowTime = performance.now();
84+
let deltaTime = nowTime - lastTime;
85+
86+
if (repeatDelay <= deltaTime) {
87+
let obj = {};
88+
obj[axis] = degrees += 90;
89+
90+
this.setState({ ...obj, iteration: (this.state.iteration + 1) % 4 });
91+
lastTime = performance.now();
92+
}
93+
94+
this._requestAnimation = requestAnimationFrame(animation);
95+
};
96+
animation();
8797
}
8898
}
8999

@@ -95,7 +105,7 @@ export default class Cube extends React.Component {
95105
this.container.removeEventListener('mouseleave', this.listeners.reset);
96106

97107
} else if (continuous) {
98-
clearInterval(this._interval);
108+
cancelAnimationFrame(this._requestAnimation);
99109
}
100110
}
101111

components/footer/footer.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import './footer-style';
77

88
export default (props) => {
99
return (
10-
<div className="footer">
10+
<footer className="footer">
1111
<Container className="footer__inner">
1212
<section className="footer__left">
13-
<Link className="footer__link" to="/get-started">起步</Link>
13+
<Link className="footer__link" to="/guides/get-started">起步</Link>
1414
<Link className="footer__link" to="/organization">组织</Link>
1515
<Link className="footer__link" to="/contribute">贡献</Link>
16-
<Link className="footer__link" to="/get-started/why-webpack#comparison">比较</Link>
16+
<Link className="footer__link" to="/guides/why-webpack#comparison">比较</Link>
1717
</section>
1818

1919
<section className="footer__middle">
@@ -31,6 +31,6 @@ export default (props) => {
3131
<CC />
3232
</section>
3333
</Container>
34-
</div>
34+
</footer>
3535
);
3636
};

components/navigation/navigation.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,26 @@ let Sections = [
1919
children: [
2020
{ title: 'API', url: 'api' },
2121
{ title: '配置', url: 'configuration' },
22-
{ title: '加载器', url: 'loaders' },
23-
{ title: '插件', url: 'plugins' }
22+
{ title: 'LOADER', url: 'loaders' },
23+
{ title: '插件', url: 'plugins' },
24+
{ title: '开发', url: 'development' }
2425
]
2526
},
2627
{
2728
title: '捐赠',
2829
url: '//opencollective.com/webpack'
30+
},
31+
{
32+
title: 'Blog',
33+
url: '//medium.com/webpack'
2934
}
3035
];
3136

3237
// TODO: Move back to using state once we can handle algolia on our own
3338
export default class Navigation extends React.Component {
3439
render() {
3540
let { pageUrl = '' } = this.props;
36-
41+
3742
return (
3843
<header className="navigation">
3944
<Container className="navigation__inner">

components/organization/projects.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{
1616
"repo": "webpack/loader-utils",
1717
"npm": "loader-utils",
18-
"description": "Webpack loader utilities.",
18+
"description": "webpack loader utilities.",
1919
"maintainer": "sokra"
2020
},
2121
{
@@ -289,4 +289,3 @@
289289
"maintainer": "thelarkinn"
290290
}
291291
]
292-

components/page/page-style.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
}
1010

1111
// XXX: Temporary hack to fix sidebar width
12-
.page div:first-of-type {
12+
.page > div:first-of-type {
1313
flex: 0 0 auto;
14-
overflow: auto;
14+
position: relative;
15+
overflow: hidden;
1516

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

components/sidebar-item/sidebar-item-style.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
@import 'functions';
33

44
.sidebar-item {
5+
position: relative;
56
font-size: getFontSize(-1);
67
margin-bottom: 0.75em;
78

89
&__title {
10+
padding-right: 15px;
911
font-weight: 400;
1012
text-decoration: none;
1113
color: inherit;
@@ -16,11 +18,13 @@
1618
}
1719

1820
&__toggle {
19-
float: right;
21+
position: absolute;
22+
right: 0;
2023
line-height: 1.5;
2124
cursor: pointer;
2225
color: getColor(dusty-grey);
2326
transition: color 250ms;
27+
margin-left: 1.5rem;
2428

2529
&:hover {
2630
color: getColor(mine-shaft);
@@ -76,4 +80,4 @@
7680
display: none;
7781
}
7882
}
79-
}
83+
}

components/sidebar-item/sidebar-item.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@ export default class SidebarItem extends React.Component {
3636
}
3737

3838
toggle(e) {
39+
let { onToggle } = this.props;
40+
3941
this.setState({
4042
open: !this.state.open
43+
}, () => {
44+
if (typeof onToggle === 'function') {
45+
onToggle();
46+
}
4147
});
4248
}
4349
}

components/sidebar/sidebar-style.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
@import 'mixins';
33

44
.sidebar {
5-
position: relative;
65
display: none;
7-
flex: 1;
8-
min-height: 100%;
6+
width: 100%;
7+
max-height: 100%;
8+
overflow: auto;
99

1010
@include break {
1111
display:block;
@@ -14,6 +14,5 @@
1414

1515
.sidebar__inner {
1616
padding: 1.5em;
17-
overflow-y: auto;
18-
overflow-x: hidden;
17+
overflow: hidden;
1918
}

0 commit comments

Comments
 (0)