Skip to content

docs(en): merge webpack.js.org/master into webpack.js.org/cn @ 570c5cec #1259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .alexignore

This file was deleted.

35 changes: 0 additions & 35 deletions .alexrc

This file was deleted.

7 changes: 7 additions & 0 deletions src/components/BrandingSample.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import PropTypes from 'prop-types';
BrandingSample.propTypes = {
color: PropTypes.string.isRequired,
};
export default function BrandingSample({ color }) {
return <div style={{ backgroundColor: color }}>&nbsp;</div>;
}
3 changes: 3 additions & 0 deletions src/components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ const Footer = () => (
<Link className="footer__link" to="https://webpack.threadless.com/">
周边
</Link>
<Link className="footer__link" to="/awesome-webpack/">
Awesome webpack
</Link>
<Link className="footer__link" to="/glossary/">
术语
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Site/Site.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function Site(props) {
*/
const _strip = (array) => {
let anchorTitleIndex = array.findIndex(
(item) => item.name.toLowerCase() === 'index.md'
(item) => item.name.toLowerCase() === 'index.mdx'
);

if (anchorTitleIndex !== -1) {
Expand Down
8 changes: 2 additions & 6 deletions src/components/Splash/Splash.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { PlaceholderComponent } from '../Placeholder/Placeholder';
import isClient from '../../utilities/is-client';

// Import Demo Content
import SplashContent from '../../content/index.md';
import SplashContent from '../../content/index.mdx';

// Load Styling
import './Splash.scss';
Expand Down Expand Up @@ -55,11 +55,7 @@ const Splash = () => {
<div className="splash__section splash__section--dark page__content">
<Container>
<Markdown>
<div
dangerouslySetInnerHTML={{
__html: SplashContent,
}}
/>
<SplashContent />
</Markdown>
</Container>
</div>
Expand Down
7 changes: 7 additions & 0 deletions src/components/Splash/first/left.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**src/index.js**

```js
import bar from './bar.js';

bar();
```
7 changes: 7 additions & 0 deletions src/components/Splash/first/right.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**src/bar.js**

```js
export default function bar() {
//
}
```
13 changes: 13 additions & 0 deletions src/components/Splash/second/left.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**[Without config](https://youtu.be/3Nv9muOkb6k?t=21293)** or provide custom **webpack.config.js**

```js
const path = require('path');

module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
};
```
15 changes: 15 additions & 0 deletions src/components/Splash/second/right.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
**page.html**

```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
...
</head>
<body>
...
<script src="dist/bundle.js"></script>
</body>
</html>
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
287 changes: 287 additions & 0 deletions src/content/awesome-webpack.mdx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ webpack 是完全基于[赞助](https://opencollective.com/webpack)的。

### 不再为 Node.js 模块 自动引用 Polyfills {#automatic-nodejs-polyfills-removed}

<<<<<<< HEAD:src/content/blog/2020-10-10-webpack-5-release.md
在早期,webpack 的目的是为了让大多数的 Node.js 模块运行在浏览器中,但如今模块的格局已经发生了变化,现在许多模块主要是为前端而编写。webpack <= 4 的版本中提供了许多 Node.js 核心模块的 polyfills,一旦某个模块引用了任何一个核心模块(如 `cypto` 模块),webpack 就会自动引用这些 polyfills。
=======
In the early days, webpack's aim was to allow running most Node.js modules in the browser, but the module landscape changed and many module uses are now written mainly for frontend purposes. webpack &lt;= 4 ships with polyfills for many of the Node.js core modules, which are automatically applied once a module uses any of the core modules (i.e. the `crypto` module).
>>>>>>> 570c5cec2aa7c32e20dc9ec36c06c2791a508946:src/content/blog/2020-10-10-webpack-5-release.mdx

尽管这会使得使用为 Node.js 编写模块变得容易,但它在构建时给 bundle 附加了庞大的 polyfills。在大部分情况下,这些 polyfills 并非必须。

Expand Down
File renamed without changes.
63 changes: 56 additions & 7 deletions src/content/branding.md → src/content/branding.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ translators:
- jacob-lcs
---

<<<<<<< HEAD:src/content/branding.md
在这里你可以找到 **webpack** 项目的品牌指南、资源和许可证。有关更多信息,请通过查看我们的官方[媒体仓库](https://github.com/webpack/media),并找到[许可证](https://github.com/webpack/media/blob/master/LICENSE)来了解。点击任意图片下载它们。
=======
import BrandingSample from '../components/BrandingSample.jsx';

Here you can find **webpack** project brand guidelines, assets, and license. See our official [media repository](https://github.com/webpack/media) for more information and to find the [license](https://github.com/webpack/media/blob/master/LICENSE) that governs this work. Click any of the images to download them.
>>>>>>> 570c5cec2aa7c32e20dc9ec36c06c2791a508946:src/content/branding.mdx

## 名称 {#the-name}

Expand All @@ -22,16 +28,27 @@ Webpack 在句子的开头可以是大写字母 W,否则它应该全部为小

webpack logo 应放置在白色背景上,并且其周围有足够间距,如下所示:

<img src="https://raw.githubusercontent.com/webpack/media/master/logo/logo-on-white-bg.png" alt="webpack logo default with proper spacing on light background" />
<img
src="https://raw.githubusercontent.com/webpack/media/master/logo/logo-on-white-bg.png"
alt="webpack logo default with proper spacing on light background"
/>

[svg](https://github.com/webpack/media/blob/master/logo/logo-on-white-bg.svg) | [png](https://github.com/webpack/media/blob/master/logo/logo-on-white-bg.png) | [jpg](https://github.com/webpack/media/blob/master/logo/logo-on-white-bg.jpg)

将内部深蓝色正方体的大小加倍,就可以知道 logo 应占据多大空间。

对于深色背景,可以使用 logo 的反色版本:

<div style="display: block; background: #111;">
<img src="https://raw.githubusercontent.com/webpack/media/master/logo/logo-on-dark-bg.png" alt="webpack logo default with proper spacing on light background" />
export const style = {
display: 'block',
background: '#111',
};

<div style={style}>
<img
src="https://raw.githubusercontent.com/webpack/media/master/logo/logo-on-dark-bg.png"
alt="webpack logo default with proper spacing on light background"
/>
</div>

[svg](https://github.com/webpack/media/blob/master/logo/logo-on-dark-bg.svg) | [png](https://github.com/webpack/media/blob/master/logo/logo-on-dark-bg.png) | [jpg](https://github.com/webpack/media/blob/master/logo/logo-on-dark-bg.jpg)
Expand All @@ -42,30 +59,47 @@ T> 请尽可能的使用**图标 + 文本**的组合方式。

**图标旨在用于布局有限的区域。如前所述,最好选择 图标+文字 的组合方式**。

<img src="https://raw.githubusercontent.com/webpack/media/master/logo/icon.png" width="250" alt="icon example">
<img
src="https://raw.githubusercontent.com/webpack/media/master/logo/icon.png"
width="250"
alt="icon example"
/>

[svg](https://github.com/webpack/media/blob/master/logo/icon.svg) | [png](https://github.com/webpack/media/blob/master/logo/icon.png) | [jpg](https://github.com/webpack/media/blob/master/logo/icon.jpg)

适用于较大区域的正方形尺寸图标(例如头像或个人图片):

<img src="https://raw.githubusercontent.com/webpack/media/master/logo/icon-square-big.png" width="250" alt="icon square big example">
<img
src="https://raw.githubusercontent.com/webpack/media/master/logo/icon-square-big.png"
width="250"
alt="icon square big example"
/>

[svg](https://github.com/webpack/media/blob/master/logo/icon-square-big.svg) | [png](https://github.com/webpack/media/blob/master/logo/icon-square-big.png) | [jpg](https://github.com/webpack/media/blob/master/logo/icon-square-big.jpg)

适用于较小区域的正方形尺寸图标(例如,favicon):

<img src="https://raw.githubusercontent.com/webpack/media/master/logo/icon-square-small.png" width="50" alt="icon square small example">
<img
src="https://raw.githubusercontent.com/webpack/media/master/logo/icon-square-small.png"
width="50"
alt="icon square small example"
/>

[svg](https://github.com/webpack/media/blob/master/logo/icon-square-small.svg) | [png](https://github.com/webpack/media/blob/master/logo/icon-square-small.png) | [jpg](https://github.com/webpack/media/blob/master/logo/icon-square-small.jpg)

T> 对于那些遵循我们的指南,并已经深入了解的人,我们还制作了一个专门用于自定义 emoji 符号的特殊小尺寸图片(例如,在 slack 或 gitter 频道 ;))。

<img src="/assets/icon-square-small-slack.png" width="50" alt="icon square small example">
<img
src="/assets/icon-square-small-slack.png"
width="50"
alt="icon square small example"
/>

## 调色板 {#color-palette}

在 [Open Collective](https://opencollective.com/) 和 [Threadless](https://medium.com/u/840563ee2a56) 的帮助下,以下颜色在我们整个网站中被以各种组合形式使用,并且在 [webpack 官方商城](https://webpack.threadless.com/collections/the-final-release-collection/) 推出的时尚服装系列中也用了这些颜色!

<<<<<<< HEAD:src/content/branding.md
| 颜色名称 | HEX 码 | RGB 码 | 示例 |
| ------------ | ------------- | -------------------- | ---------------------------------------------------- |
| Malibu: | HEX `#8dd6f9` | `rgb: 141, 214, 249` | <div style="background-color: #8dd6f9;">&nbsp;</div> |
Expand All @@ -79,6 +113,21 @@ T> 对于那些遵循我们的指南,并已经深入了解的人,我们还
| Dove Gray: | HEX `#666666` | `rgb: 102, 102, 102` | <div style="background-color: #666666;">&nbsp;</div> |
| Emperor: | HEX `#535353` | `rgb: 83, 83, 83` | <div style="background-color: #535353;">&nbsp;</div> |
| Mine Shaft: | HEX `#333333` | `rgb: 51, 51, 51` | <div style="background-color: #333333;">&nbsp;</div> |
=======
| Color Name | HEX Code | RGB Code | Sample |
| ------------ | ------------- | -------------------- | ---------------------------------- |
| Malibu: | HEX `#8dd6f9` | `rgb: 141, 214, 249` | <BrandingSample color='#8dd6f9' /> |
| Denim: | HEX `#1d78c1` | `rgb: 29, 120, 193` | <BrandingSample color='#1d78c1' /> |
| Fiord: | HEX `#465E69` | `rgb: 70, 94, 105` | <BrandingSample color='#465E69' /> |
| Outer Space: | HEX `#2B3A42` | `rgb: 43, 58, 66` | <BrandingSample color='#2B3A42' /> |
| White: | HEX `#ffffff` | `rgb: 255, 255, 255` | <BrandingSample color='#ffffff' /> |
| Concrete: | HEX `#f2f2f2` | `rgb: 242, 242, 242` | <BrandingSample color='#f2f2f2' /> |
| Alto: | HEX `#dedede` | `rgb: 222, 222, 222` | <BrandingSample color='#dedede' /> |
| Dusty Gray: | HEX `#999999` | `rgb: 153, 153, 153` | <BrandingSample color='#999999' /> |
| Dove Gray: | HEX `#666666` | `rgb: 102, 102, 102` | <BrandingSample color='#666666' /> |
| Emperor: | HEX `#535353` | `rgb: 83, 83, 83` | <BrandingSample color='#535353' /> |
| Mine Shaft: | HEX `#333333` | `rgb: 51, 51, 51` | <BrandingSample color='#333333' /> |
>>>>>>> 570c5cec2aa7c32e20dc9ec36c06c2791a508946:src/content/branding.mdx

此外,你可以直接从下面的链接,获取这些类型的文件:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ const pluginName = 'ConsoleLogOnBuildWebpackPlugin';
class ConsoleLogOnBuildWebpackPlugin {
apply(compiler) {
compiler.hooks.run.tap(pluginName, (compilation) => {
<<<<<<< HEAD:src/content/concepts/plugins.md
console.log('webpack 构建过程开始!');
=======
console.log('The webpack build process is starting!');
>>>>>>> 570c5cec2aa7c32e20dc9ec36c06c2791a508946:src/content/concepts/plugins.mdx
});
}
}
Expand Down
File renamed without changes.
Loading