-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Korean Docs] Update docs for v12.x (#803)
* [Korean] Update docs * [Korean] Update advanced * [Korean] update spec.md * [Korean] update scoped-css.md * [Korean] update postcss.md * [Korean] update extract-css.md * [Korean] update custom-blocks.md * [Korean] Update options.md * [Korean] Update vue component spec * [Korean] update advanced * [Korean] Update postcss.md * [Korean] Update extract-css.md * [Korean] Update custom-blocks.md * [Korean] Update Summary.md * [Korean] Fix sentences
- Loading branch information
1 parent
99a2b7a
commit 7db1b25
Showing
8 changed files
with
433 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,81 @@ | ||
# ๊ณ ๊ธ ๋ก๋ ์ค์ | ||
|
||
๋๋ก๋ `vue-loader`๊ฐ ๊ทธ๊ฒ์ ์ถ๋ก ํ๋ ๋์ ์ธ์ด์ ์ฌ์ฉ์ ์ ์ ๋ก๋ ๋ฌธ์์ด์ ์ ์ฉํ๊ธฐ๋ฅผ ์ํ ์๋ ์์ต๋๋ค. ๋๋ ๊ธฐ๋ณธ ์ธ์ด์์ ๊ธฐ๋ณธ์ ์ผ๋ก ์ ๊ณต๋๋ ๋ก๋ ์ค์ ์ ๋ฎ์ด์ฐ๊ณ ์ถ์ ์๋ ์์ต๋๋ค. ์ด๋ฅผ ์ํด์ Webpack ์ค์ ํ์ผ์ `vue` ๋ธ๋ญ์ ์ถ๊ฐํ๊ณ `loaders` ์ต์ ์ ์ง์ ํ ์ ์์ต๋๋ค. | ||
์๋์ ๊ฐ์ ์๊ตฌ์ฌํญ์ด ์์ ์ ์์ต๋๋ค. | ||
|
||
### Webpack 1.x | ||
1. `vue-loader`๊ฐ ์ถ์ธกํ๋ ๋์ ์ธ์ด์ ๋ง๋ ์ฌ์ฉ์ ์ ์ ๋ก๋๋ฅผ ์ฌ์ฉํด์ผํฉ๋๋ค. | ||
|
||
2. ๊ธฐ๋ณธ ์ธ์ด์ ๋ํ ๋ก๋๋ฅผ ๋ฎ์ด์จ์ผํฉ๋๋ค. | ||
|
||
3. ํน์ language block์ ์ํ ์ฌ์ฉ์ ์ ์ ํ๋ฆฌ ๋๋ ํฌ์คํธ ํ๋ก์ธ์ค๋ฅผ ํด์ผํฉ๋๋ค. | ||
|
||
์ด๋ฅผ ์ํด `vue-loader`์ `loaders` ์ต์ ์ ์ง์ ํด์ผํฉ๋๋ค. | ||
|
||
> ์ฐธ๊ณ : `preLoaders`์ `postLoaders`๋ 10.3.0 ๋ฒ์ ์ด์์์๋ง ์ง์ํฉ๋๋ค. | ||
### Webpack 2.x | ||
|
||
``` js | ||
// webpack.config.js | ||
module.exports = { | ||
// ์ด ๋ถ๋ถ์ ๋ค๋ฅธ ์ต์ ๋ ๋ค์ด ๊ฐ ์ ์์ต๋๋ค. | ||
// ๊ธฐํ ์ต์ ๋ค... | ||
module: { | ||
loaders: [ | ||
// module.rules์ 1.x๋ฒ์ ์ module.loaders๊ณผ ๊ฐ์ต๋๋ค | ||
rules: [ | ||
{ | ||
test: /\.vue$/, | ||
loader: 'vue' | ||
loader: 'vue-loader', | ||
options: { | ||
// `loaders`๋ ๊ธฐ๋ณธ ๋ก๋๋ฅผ ๋ฎ์ด์๋๋ค. | ||
// ๋ค์ ์ค์ ์ "lang" ์์ฑ์ด ์๋ | ||
// ๋ชจ๋ <script> ํ๊ทธ๊ฐ coffee ๋ก๋์ ํจ๊ป ๋ก๋๋๋๋ก ํฉ๋๋ค | ||
loaders: { | ||
js: 'coffee-loader' | ||
}, | ||
|
||
// `preLoaders`๋ ๊ธฐ๋ณธ ๋ก๋ ์์ ๋ถ์ต๋๋ค. | ||
// ์ด๋ฅผ ์ด์ฉํด language block์ ํ๋ฆฌ ํ๋ก์ธ์คํ ์ ์์ต๋๋ค. | ||
// ์ผ๋ฐ์ ์ผ๋ก ๋น๋ํ์์ ๋ค๊ตญ์ด ์ฒ๋ฆฌ๋ฅผ ํ ์ ์์ต๋๋ค. | ||
preLoaders: { | ||
js: '/path/to/custom/loader' | ||
}, | ||
|
||
// `postLoaders`๋ ๊ธฐ๋ณธ ๋ก๋ ๋ค์ ๋ถ์ต๋๋ค. | ||
// - `html`์ ๊ฒฝ์ฐ, ๊ธฐ๋ณธ ๋ก๋์ ๊ฒฐ๊ณผ๋ ์ปดํ์ผ ๋ JavaScript ๋ ๋๋ง ํจ์ ์ฝ๋๊ฐ ๋ฉ๋๋ค. | ||
|
||
// - `css`์ ๊ฒฝ์ฐ, ๊ฒฐ๊ณผ๋ `vue-style-loader`๊ฐ ๋ฐํํ๊ณ | ||
// ๋๋ถ๋ถ์ ๊ฒฝ์ฐ ๋ณ๋ก ์ฌ์ฉํ ์ผ์ ์์ต๋๋ค. postcss ํ๋ฌ๊ทธ์ธ์ ์ฌ์ฉํ๋ ๊ฒ์ด ๋ ์ข์ต๋๋ค. | ||
postLoaders: { | ||
html: 'babel-loader' | ||
}, | ||
|
||
// `excludedPreLoaders`๋ ๋ฐ๋์ ์ ๊ทํํ์์ ์ฌ์ฉํฉ๋๋ค | ||
excludedPreLoaders: /(eslint-loader)/ | ||
} | ||
} | ||
] | ||
}, | ||
// vue-loader ์ค์ | ||
vue: { | ||
// ์ด ๋ถ๋ถ์ ๋ค๋ฅธ Vue ์ต์ ๋ ๋ค์ด ๊ฐ ์ ์์ต๋๋ค. | ||
loaders: { | ||
// coffee-loader์ "lang" ์์ฑ์ด ์๋ ๋ชจ๋ <script>๋ฅผ ๋ก๋ํ์ธ์. | ||
js: 'coffee', | ||
// <template>์ HTML ๋ฌธ์์ด๋ก ์ง์ ๋ก๋ํ๋ฉด | ||
// vue-html-loader๋ฅผ ํตํด ํ์ดํํ์ง ์์๋ ๋ฉ๋๋ค. | ||
html: 'raw' | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Webpack 2.x (^2.1.0-beta.25) | ||
### Webpack 1.x | ||
|
||
``` js | ||
// webpack.config.js | ||
module.exports = { | ||
// ์ด ๋ถ๋ถ์ ๋ค๋ฅธ ์ต์ ๋ ๋ค์ด ๊ฐ ์ ์์ต๋๋ค. | ||
// ๊ธฐํ ์ต์ ๋ค... | ||
module: { | ||
// module.rules๋ 1.x์ module.loaders์ ๋์ผํฉ๋๋ค. | ||
rules: [ | ||
loaders: [ | ||
{ | ||
test: /\.vue$/, | ||
loader: 'vue', | ||
// vue-loader ์ต์ ์ ์ด๊ณณ์ ์ต๋๋ค. | ||
options: { | ||
loaders: { | ||
// ... | ||
} | ||
} | ||
loader: 'vue' | ||
} | ||
] | ||
}, | ||
// vue-loader ์ค์ | ||
vue: { | ||
loaders: { | ||
// ์์ ๋์ผํ ์ค์ ๊ท์น์ ๋๋ค | ||
} | ||
} | ||
} | ||
``` | ||
|
||
๊ณ ๊ธ ๋ก๋ ์ค์ ์ ๋ณด๋ค ์ค์ฉ์ ์ผ๋ก ์ฌ์ฉํ๋ฉด [์ปดํฌ๋ํธ ๋ด๋ถ์ CSS๋ฅผ ๋จ์ผ ํ์ผ๋ก ์ถ์ถํ ์ ์์ต๋๋ค](./extract-css.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# ์ฌ์ฉ์ ์ ์ ๋ธ๋ก | ||
|
||
> 10.2.0 ๋ฒ์ ์ด์์์ ์ง์ | ||
`*.vue` ํ์ผ ์์ ์ฌ์ฉ์ ์ ์ language block์ ์ ์ํ ์ ์์ต๋๋ค. ์ฌ์ฉ์ ์ ์ ๋ธ๋ก์์ ๋ด์ฉ์ `vue-loader` ์ต์ ์ `loaders` ๊ฐ์ฒด์ ์ง์ ๋ ๋ก๋์์ ์ฒ๋ฆฌ๋ ๋ค์ ์ปดํฌ๋ํธ ๋ชจ๋์์ ์๊ตฌ๋ฉ๋๋ค. ์ค์ ์ [๊ณ ๊ธ ๋ก๋ ์ค์ ](../configurations/advanced.md)์์ ์ค๋ช ํ ๋ด์ฉ๊ณผ ์ ์ฌํฉ๋๋ค. ๋จ, ์ผ์นํ๋ ๊ฒฝ์ฐ `lang` ์์ฑ ๋์ ํ๊ทธ ์ด๋ฆ์ ์ฌ์ฉํฉ๋๋ค. | ||
|
||
์ฌ์ฉ์ ์ ์ ๋ธ๋ก์ ์ผ์นํ๋ ๋ก๋๊ฐ ๋ฐ๊ฒฌ๋๋ฉด ์ฒ๋ฆฌํฉ๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ๋ฌด์ํฉ๋๋ค. ๋ํ ๋ฐ๊ฒฌ๋ ๋ก๋๊ฐ ํจ์๋ฅผ ๋ฐํํ๋ฉด ํด๋น ํจ์๋ `*.vue`ํ์ผ์ ์ปดํฌ๋ํธ๋ฅผ ๋งค๊ฐ๋ณ์๋ก ์ฌ์ฉํ์ฌ ํธ์ถํฉ๋๋ค. | ||
|
||
## ๋จ์ผ ๋ฌธ์ ํ์ผ ์์ | ||
|
||
๋ค์์ ๋ชจ๋ `<docs>` ์ฌ์ฉ์ ์ ์ ๋ธ๋ก์ ํ๋์ ๋ฌธ์ ํ์ผ๋ก ์ถ์ถํ๋ ์ ์ ๋๋ค. | ||
|
||
#### component.vue | ||
|
||
``` html | ||
<docs> | ||
## This is an Example component. | ||
</docs> | ||
|
||
<template> | ||
<h2 class="red">{{msg}}</h2> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data () { | ||
return { | ||
msg: 'Hello from Component A!' | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
comp-a h2 { | ||
color: #f00; | ||
} | ||
</style> | ||
``` | ||
|
||
#### webpack.config.js | ||
|
||
``` js | ||
// Webpack 2.x | ||
var ExtractTextPlugin = require("extract-text-webpack-plugin") | ||
|
||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.vue$/, | ||
loader: 'vue', | ||
options: { | ||
loaders: { | ||
// ๋ชจ๋ <docs>์ ๋ด์ฉ์ ์๋ฌธ ๊ทธ๋๋ก ์ถ์ถํฉ๋๋ค | ||
'docs': ExtractTextPlugin.extract('raw-loader'), | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
// ๋ชจ๋ docs๋ฅผ ํ๋์ ํ์ผ๋ก ์ถ์ถํฉ๋๋ค | ||
new ExtractTextPlugin('docs.md') | ||
] | ||
} | ||
``` | ||
|
||
## ๋ฐํ์์์ ์ฌ์ฉํ ์ ์๋ ๋ฌธ์ | ||
|
||
๋ค์์ `<docs>` ์ฌ์ฉ์ ์ ์ ๋ธ๋ก์ ์ปดํฌ๋ํธ์ ๋ฃ์ด ๋ฐํ์์์ ์ฌ์ฉํ ์ ์๋ ์์ ์ ๋๋ค. | ||
|
||
#### docs-loader.js | ||
|
||
์ฌ์ฉ์ ์ ์ ๋ธ๋ก ์ฝํ ํธ๋ฅผ ์ฝ์ ํ๋ ค๋ฉด ์ฌ์ฉ์ ์ ์ ๋ก๋๊ฐ ํ์ํฉ๋๋ค. | ||
|
||
``` js | ||
module.exports = function (source, map) { | ||
this.callback(null, 'module.exports = function(Component) {Component.options.__docs = ' + | ||
JSON.stringify(source) + | ||
'}', map) | ||
} | ||
``` | ||
|
||
#### webpack.config.js | ||
|
||
webpack์ด `<docs>` ์ฌ์ฉ์ ์ ์ ๋ธ๋ก์ ์ํ ๋ก๋๋ฅผ ์ฌ์ฉํ๋๋ก ์ค์ ํฉ๋๋ค. | ||
|
||
``` js | ||
const docsLoader = require.resolve('./custom-loaders/docs-loader.js') | ||
|
||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.vue$/, | ||
loader: 'vue', | ||
options: { | ||
loaders: { | ||
'docs': docsLoader | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
#### component.vue | ||
|
||
์ด์ `<docs>` ๋ธ๋ก์ ๋ด์ฉ์ ๋ฐํ์ ์ค์ ์ปดํฌ๋ํธ์์ ์ฌ์ฉํ ์ ์์ต๋๋ค. | ||
|
||
``` html | ||
<template> | ||
<div> | ||
<component-b /> | ||
<p>{{ docs }}</p> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import componentB from 'componentB'; | ||
export default = { | ||
data () { | ||
return { | ||
docs: componentB.__docs | ||
} | ||
}, | ||
components: {componentB} | ||
} | ||
</script> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.