Skip to content

Commit c90e708

Browse files
arahansaAriaFallah
authored andcommitted
Revert "add html, css example"
This reverts commit 957a06a.
1 parent 953d2fc commit c90e708

File tree

10 files changed

+395
-312
lines changed

10 files changed

+395
-312
lines changed

ko-arahansa/part1/README.md

Lines changed: 210 additions & 165 deletions
Large diffs are not rendered by default.

part1/css-extract/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Extra - Extract Your CSS
22

3-
예. 당신이 마쳤습니다만, production 에서는 css 파일이 javascript안에 들어가기를 원하지 않습니다. 이러한 목적을 위해서 우리는
3+
Ok so now you've finished, but in production you don't want your CSS file to be inline with your
4+
javascript. For this purpose we'll be using the
45
[Extract Text Plugin](https://github.com/webpack/extract-text-webpack-plugin).
5-
을 사용할 것입니다.
66

77
npm install --save-dev extract-text-webpack-plugin
88

9-
그리고 우리의 웹팩 production설정을 다음과 같이 바꿔줘야합니다 :
9+
And we make the necessary changes to our webpack prod config:
1010

1111
```javascript
1212
var path = require('path')
@@ -42,11 +42,15 @@ module.exports = {
4242
}
4343
```
4444

45-
이러한 변화는 [official-repo](https://github.com/webpack/extract-text-webpack-plugin) 에서 유래했습니다. 어떻게 이것이 동작하는 지 알고 싶다면 한번 살펴보세요.
45+
These changes come straight from the README of the
46+
[official-repo](https://github.com/webpack/extract-text-webpack-plugin). Make sure to take a look if
47+
you want to know how it works more in depth.
4648

47-
> 엔트리 청크에서 모든 require("style.css")들은 분리된 css 아웃풋 파일로 이동합니다. 그러니 당신의 스타일들은 더 이상 자바스크립트 안에 들어가지않고 css 번들파일안에 들어가게 됩니다. 만약 당신의 전체적인 스타일 시트 볼륨이 크다면, 이게 더 빠를 겁니다. 왜냐하면 스타일시트번들은 자바스크립트 번들과 병렬로 불러와지기 때문입니다.
49+
> It moves every require("style.css") in entry chunks into a separate css output file. So your styles are no longer inlined into the javascript, but separate in a css bundle file (styles.css). If your total stylesheet volume is big, it will be faster because the stylesheet bundle is loaded in parallel to the javascript bundle.
50+
51+
Now if you do an `npm run build` using this config your CSS will be in a separate file, and
52+
interestingly, already included in your `index.html`.
4853

49-
이제 당신이 `npm run build`를 하면 설정을 사용하여 CSS는 분리된 파일로 들어가게 되고, 흥미롭게도 이미 `inde.html`에 포함(include)될 것입니다.
5054
```html
5155
<html>
5256
<head>

part1/example1/README.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,19 @@
22

33
![Official Dependency Tree](http://i.imgur.com/YU4xBPQ.png)
44

5-
번들링 [예제 1](https://github.com/AriaFallah/WebpackTutorial/tree/master/ko-arahansa/part1/example1)
6-
7-
![Official Dependency Tree](http://i.imgur.com/YU4xBPQ.png)
8-
9-
웹팩은 공식적으로 모듈 번들러로 얘기됩니다.만약 당신이 좀 더 모듈과 모듈번들링에 대해서 깊이 있는 정보를 원한다면 여기 두개의 무척 좋은 글을 읽어보세요
5+
Webpack is formally referred to as a module bundler. If you want an in-depth and accessible explanation
6+
on modules and module bundling definitely check out these two great articles:
107
[here](https://medium.freecodecamp.com/javascript-modules-a-beginner-s-guide-783f7d7a5fcc#.jw1txw6uh)
118
and [here](https://medium.com/@preethikasireddy/javascript-modules-part-2-module-bundling-5020383cf306#.lfnspler2).
9+
We're gonna keep it simple. The way that it works is that you specify a single file as your entry point.
10+
This file will be the root of your tree. Then every time you `require` a file from another file it's
11+
added to the tree. When you run `webpack`, all these files/modules are bundled into a single file.
1212

13-
우리는 단순하게 갈 것입니다. 이것이 동작하는 방식은 당신이 하나의 파일을 엔트리 포인트로 설정하는 것입니다.
14-
이 파일은 당신의 트리의 root가 될 것인데 당신이 다른 파일로부터 파일을 `require` 할 때마다 이 트리에 추가가 되게 됩니다. 당신이 `webpack`을 치면 모든 이러한 파일/모듈들은 하나의 단일 파일로 번들링되게 됩니다.
15-
16-
여기 예제가 있습니다. :
13+
Here's a simple example:
1714

1815
![Dependency Tree](http://i.imgur.com/dSghwwL.png)
1916

20-
이 사진은 디렉터리를 보여줍니다 :
17+
Given this picture you could have the directory:
2118

2219
```
2320
MyDirectory
@@ -28,7 +25,7 @@ MyDirectory
2825
|- extraFile.js
2926
```
3027

31-
그리고 이것은 당신의 파일의 내용을 보여줍니다.
28+
and this could be the content of your files
3229

3330
```javascript
3431
// index.js
@@ -54,32 +51,37 @@ body {
5451
}
5552
```
5653

57-
만약 당신이 `webpack` 을 치면 당신은 이 계층구조가 가진 내용들의 번들을 받게 됩니다. 하지만 같은 폴더 내에 있어도 `required`되지 않은 `extraFile.js`은 번들링에 포함되지 않게 됩니다.
54+
When you run `webpack`, you'll get a bundle with the contents of this tree, but `extraFile.js`, which was in the same directory, will not be part of
55+
the bundle because it is not a part of the dependency tree:
5856

59-
`bundle.js` 는 다음과 같을 것입니다 :
57+
`bundle.js` will look like:
6058

6159
```javascript
6260
// contents of styles.css
6361
// contents of UIStuff.js + React
6462
// contents of APIStuff.js + fetch
6563
```
6664

67-
번들되는 것은 당신이 명시적으로 required 한 것들만 번들링됩니다.
65+
The things that are bundled are only the things that you explicitly required across your files.
6866

6967
### Loaders
7068

71-
(로더) 당신은 아마 눈치 챘겠지만, 위의 예제에서 제가 뭔가 이상한 것을 했었습니다. 저는 자바스크립트 파일에 css파일을 `required` 했습니다.
69+
As you probably noticed, I did something strange in the above example. I `required` a css file in a javascript file.
70+
71+
The really cool and interesting thing about webpack is that you can `require` more than just
72+
javascript files.
7273

73-
자바스크립트 이외의 것들을 `require` 할 수 있다는 것은 웹팩에서 꽤 좋으면서 흥미롭습니다.
74-
웹팩에서는 로더라는 것이 존재하는 데, 이러한 로더들을 사용하여서 당신은 `.css` `.png`, `.html` 파일들 같은 것 무엇이든지 `require`할 수 있습니다.
74+
There is this thing in webpack called a loader. Using these loaders, you can
75+
`require` anything from `.css` and `.png` to `.html` files.
7576

76-
예로, 위의 다이어그램에서
77+
For example in the diagram above I had
7778

7879
```javascript
7980
// index.js
8081
require('./styles.css')
8182
```
8283

83-
만약 제가 웹팩설정에 [the style-loader](https://github.com/webpack/style-loader)[the css-loader](https://github.com/webpack/css-loader)를 추가하는 것은 유효할 뿐만 아니라, 제 페이지에 실제로 적용될 것입니다.
84+
If I include [the style-loader](https://github.com/webpack/style-loader) and the [the css-loader](https://github.com/webpack/css-loader) in my webpack config, this is not only perfectly
85+
valid, but also will actually apply the CSS to my page.
8486

85-
이것은 당신이 웹팩을 가지고서 할 수 있는 많은 로더들의 하나의 예일뿐입니다.
87+
This is just a single example of the many loaders you can use with webpack.

part1/example2/README.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Example 2 - A minimal example
22

3-
(최소한의 예제)
4-
[예제 2](https://github.com/AriaFallah/WebpackTutorial/tree/master/ko-arahansa/part1/example2)
5-
6-
당신의 디렉터리 구조가 다음과 같다고 합시다 :
3+
Say your directory structure looks like this:
74

85
```
96
MyDirectory
@@ -14,29 +11,27 @@ MyDirectory
1411
1512
```
1613

17-
그러면 당신의 최소 웹팩 설정은 다음과 같이 만들 수 있을 것입니다.
14+
Then a very minimal webpack config you can make is this
1815

1916
```javascript
2017
// webpack.config.js
2118
var path = require('path')
2219

2320
module.exports = {
24-
entry: ['./src/index'], // file extension after index is optional for .js files
21+
entry: ['./src/index'], // .js after index is optional
2522
output: {
2623
path: path.join(__dirname, 'dist'),
2724
filename: 'bundle.js'
2825
}
2926
}
3027
```
3128

32-
새로운 속성들을 하나하나씩 알아보겠습니다 :
33-
34-
* [entry](https://webpack.github.io/docs/configuration.html#entry) - 당신의 번들의 엔트리포인트입니다. [번들링](#bundling) 섹션에서 좀 더 알아볼 것입니다..
29+
Going over the new properties one by one:
3530

36-
웹팩은 여러개의 번들을 생성하기를 원하면, 여러개의 엔트리 포인트들을 허용하기 때문에 엔트리포인트는 배열입니다.
31+
* [entry](https://webpack.github.io/docs/configuration.html#entry) - The entrypoint of your bundle, which we discussed in the [bundling](#bundling) section. It's an array because webpack allows multiple entry points if you want to generate multiple bundles.
3732

38-
* [output](https://webpack.github.io/docs/configuration.html#output) - 웹팩에 의해 출력되는 형태를 나타냅니다.
39-
* [path](https://webpack.github.io/docs/configuration.html#output-path) - 번들을 놓을 곳입니다.
40-
* [filename](https://webpack.github.io/docs/configuration.html#output-filename) - 번들을 어떻게 부를 지 나타냅니다.
33+
* [output](https://webpack.github.io/docs/configuration.html#output) - Dictates the form of the output by webpack
34+
* [path](https://webpack.github.io/docs/configuration.html#output-path) - where to put the bundle
35+
* [filename](https://webpack.github.io/docs/configuration.html#output-filename) - what to call the bundle
4136

42-
`webpack`을 실행하면 이것은 `bundle.js` 라는 파일을 dist폴더 안에 생성할 것입니다.
37+
When you run `webpack`, this will create a file called `bundle.js` in the dist folder.

part1/example3/README.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# Example 3 - Introducing Plugins
22

3-
당신이 모든 파일들을 한꺼번에 번들링했다가 당신이 그것이 900KB라는 것을 깨달았다고 해봅시다. 이것은 번들을 최소화함으로써 개선될 수 있습니다. 제가 이전에 언급한 [UglifyJsPlugin](https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin)를 사용하여서 이러한 문제를 해결할 수 있습니다.
3+
Imagine that you've used webpack to bundle all your files together, and now you've realized that all
4+
together it's 900KB. This is a problem that can be ameliorated by minifying your bundle. To do this
5+
you need to use a plugin I mentioned earlier called the
6+
[UglifyJsPlugin](https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin).
47

5-
당신은 플러그인을 사용하려고 웹팩을 로컬로 설치하고 싶을 겁니다.
8+
Moreover you will need to have webpack installed locally to actually be able to use the plugin.
69

710
npm install --save-dev webpack
811

9-
당신은 이제 웹팩을 사용하여서 코드를 최소화 하세요
12+
Now you can require webpack and minify your code.
1013

1114
```javascript
1215
// webpack.config.js
@@ -29,22 +32,21 @@ module.exports = {
2932
]
3033
}
3134
```
35+
Going over the new properties one by one:
3236

33-
새로운 속성들을 하나하나 알아보도록 하겠습니다 :
37+
* plugins - An array that holds your plugins.
38+
* [webpack.optimize.UglifyJsPlugin](https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin) - Minify your code, and suppress warning messages.
3439

35-
* plugins - 플러그인들을 적을 배열.
36-
* [webpack.optimize.UglifyJsPlugin](https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin) - 코드를 최소화하고 경고 메시지를 숨깁니다.
40+
This time, when you run `webpack`, now that you have the `UglifyJsPlugin` this could reduce your
41+
imaginary 900KB file to 200KB by through processes such as removing all the whitespace.
3742

38-
여기서 당신이 `webpack`을 칠 때, 당신은 `UglifyJsPlugin`을 가지고서 공백을 제거함으로써 900KB를 200KB 까지 줄일 수 있습니다.
43+
You can also add the [OrderOccurencePlugin](https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin)
3944

40-
당신은 또한 [OccurrenceOrderPlugin](https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin) 을 추가할 수가 있습니다.
45+
> Assign the module and chunk ids by occurrence count. Ids that are used often get lower (shorter) ids. This make ids predictable, reduces to total file size and is recommended.
4146
42-
> 모듈을 할당하고 발생 카운트 아이디들을 발생(?chunk)시킵니다. ID들은 종종 적은(짧은) id들을 얻는데 사용됩니다. 이것은 id가 예상가능하며 파일 전체 크기를 경감시켜 추천됩니다.
47+
To be honest I'm not sure how the underlying mechanisms work, but in the current [webpack2 beta it's included by default](https://gist.github.com/sokra/27b24881210b56bbaff7) so I include it as well.
4348

44-
솔직히 어떤 메커니즘이 하부에 있는 지 모르겠지만 현재(1버젼?)에서는 기본으로 들어가지 않기 때문에 [webpack2 beta it's included by default](https://gist.github.com/sokra/27b24881210b56bbaff7), 이것또한 추가해줬습니다 .
45-
46-
47-
```JavaScript
49+
```javascript
4850
// webpack.config.js
4951
var path = require('path')
5052
var webpack = require('webpack')
@@ -61,9 +63,12 @@ module.exports = {
6163
warnings: false,
6264
},
6365
}),
64-
new webpack.optimize.OccurrenceOrderPlugin()
66+
new webpack.optimize.OccurenceOrderPlugin()
6567
]
6668
}
6769
```
6870

69-
우리는 설정파일을 써서 우리의 번들 자바스크립트 파일을 최소화하였습니다. 이 번들은 다른 프로젝트의 디렉터리로 복사될 수 있습니다. 그리고 그곳의 script태그로 던져질 수 있습니다. 만약 당신이 웹팩의 기초만을 *자바스크립트만* 사용하기를 원한다면 [결론](#conclusion)을 생략할 수 있습니다.
71+
So now we have written a config that allows us to minify and bundle our javascript. This bundle
72+
could be copied and pasted into another project's directory, and thrown into a `<script>` tag there.
73+
You can skip to the [conclusion](#conclusion) if you only care about the basics of using webpack
74+
with *only javascript*.

part1/example4/README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
이 튜토리얼의 앞에서 [로더들](#loaders)을 얘기했듯이, 이것들은 우리에게 js파일이 아닌것을 우리의 코드에 require하게 해줍니다. 이러한 경우 우리는 style loader 와 css loader를 필요로 합니다. 먼저 이 로더들을 설치하도록 하겠습니다:
1+
Earlier in the tutorial I mentioned [loaders](#loaders). These will help us require non-js files in
2+
our code. In this case, the only loader we will need is the css loader. First we need to install the loader:
23

34
npm install --save-dev style-loader css-loader
45

5-
이제 이것들은 설치되었고 설정을 좀 더 바꿔서 css loader 를 추가해줘보도록 하겠습니다. :
6-
6+
Now that it's installed we can tweak our config to include the css loader:
77

88
```javascript
99
// webpack.config.js
@@ -22,7 +22,7 @@ module.exports = {
2222
warnings: false,
2323
},
2424
}),
25-
new webpack.optimize.OccurrenceOrderPlugin()
25+
new webpack.optimize.OccurenceOrderPlugin()
2626
],
2727
module: {
2828
loaders: [{
@@ -33,16 +33,18 @@ module.exports = {
3333
}
3434
```
3535

36-
새로운 속성들을 하나하나 알아보도록 하겠습니다 :
36+
Going over the new properties one by one:
3737

38-
* [모듈](http://webpack.github.io/docs/configuration.html#module) - 당신의 파일들에 영향을 주는 옵션들 입니다.
39-
* [loaders](http://webpack.github.io/docs/configuration.html#module-loaders) - 어플리케이션을 위해 적어줄 로더들의 배열입니다.
40-
* test - 로더가 적용될 파일을 매칭하기 위한 정규식입니다.
41-
* loaders - test에서 매칭된 파일에 어떤 로더를 사용할지 결정합니다.
38+
* [module](http://webpack.github.io/docs/configuration.html#module) - Options affecting your files
39+
* [loaders](http://webpack.github.io/docs/configuration.html#module-loaders) - An array of loaders that we specify for our application
40+
* test - A regular expression to match the loader with a file
41+
* loaders - Which loaders to use for files that match the test
4242

43-
여기서 우리가 `webpack`을 실행할 때, 만약 당신이 `.css`로 끝나는 파일들을 `require` 했다면 우리는 이것들에 `style``css` 로더를 적용하고 번들에 해당 css를 추가합니다.
43+
This time when you run `webpack`, if we `require` a file that ends in `.css`, then we will apply
44+
the `style` and `css` loaders to it, which adds the CSS to the bundle.
4445

45-
만약 우리가 로더들을 가지고 있지 않았다면, 우리는 다음과 같은 에러를 얻을 것입니다 :
46+
If we didn't have the loaders,
47+
then we would get an error like this:
4648

4749
```
4850
ERROR in ./test.css
@@ -51,13 +53,13 @@ Line 1: Unexpected token {
5153
You may need an appropriate loader to handle this file type.
5254
```
5355

54-
**Optional(옵션)**
56+
**Optional**
5557

56-
만약 당신이 CSS대신에 SCSS 를 사용하기를 원핟다면 다음과 같이 실행하세요 :
58+
If you want to use SCSS instead of CSS you would need to run:
5759

5860
npm install --save-dev sass-loader node-sass webpack
5961

60-
그리고 로더 부분을 다음과 같이 적으세요..
62+
and instead your loader would be written as
6163

6264
```javascript
6365
{
@@ -66,6 +68,6 @@ You may need an appropriate loader to handle this file type.
6668
}
6769
```
6870

69-
LESS도 비슷합니다.
71+
The process is similar for LESS.
7072

71-
로더를 인식하는 점에서 중요한 점은 이러한 로더들이 적혀지는 *순서*입니다. 위의 예제에서 `sass`로더가 제일 처음 당신의 `.scss` 파일들에 적용이 되고 그리고 `css`로더가 적용이 되며 마지막으로 `style`로더가 적용이 되게 됩니다. 당신이 볼 수 있듯이, 패턴이 적용되는 순서는 오른쪽에서 왼쪽입니다.
73+
An important aspect to recognize is that there is an *order* to which these loaders need to be specified. In the above example, the `sass` loader is first applied to your `.scss` files, then the `css` loader, and finally the `style` loader. As you can see, the pattern is that these loaders are applied from right to left.

0 commit comments

Comments
 (0)