Commit db78dbe3 authored by Jinjiang's avatar Jinjiang

[docs][zh] translated extract-cs.md

parent 150ee0ae
# CSS Extraction # CSS 提取
::: tip :::tip 提示
Only apply CSS extraction for production so that you get CSS hot reload during development. 只有生产环境才会运用 CSS 提取,这有便于你在开发环境下进行热重载。
::: :::
## webpack 4 ## webpack 4
...@@ -15,10 +15,10 @@ npm install -D mini-css-extract-plugin ...@@ -15,10 +15,10 @@ npm install -D mini-css-extract-plugin
var MiniCssExtractPlugin = require('mini-css-extract-plugin') var MiniCssExtractPlugin = require('mini-css-extract-plugin')
module.exports = { module.exports = {
// other options... // 其它选项...
module: { module: {
rules: [ rules: [
// ...other rules omitted // ...其它规则忽略
{ {
test: /\.css$/, test: /\.css$/,
use: [ use: [
...@@ -31,7 +31,7 @@ module.exports = { ...@@ -31,7 +31,7 @@ module.exports = {
] ]
}, },
plugins: [ plugins: [
// ...vue-loader plugin omitted // ...vue-loader 插件忽略
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: style.css filename: style.css
}) })
...@@ -39,7 +39,7 @@ module.exports = { ...@@ -39,7 +39,7 @@ module.exports = {
} }
``` ```
Also see [mini-css-extract-plugin docs](https://github.com/webpack-contrib/mini-css-extract-plugin). 你还可以查阅 [mini-css-extract-plugin 文档](https://github.com/webpack-contrib/mini-css-extract-plugin)
## webpack 3 ## webpack 3
...@@ -52,10 +52,10 @@ npm install -D extract-text-webpack-plugin ...@@ -52,10 +52,10 @@ npm install -D extract-text-webpack-plugin
var ExtractTextPlugin = require("extract-text-webpack-plugin") var ExtractTextPlugin = require("extract-text-webpack-plugin")
module.exports = { module.exports = {
// other options... // 其它选项...
module: { module: {
rules: [ rules: [
// ...other rules omitted // ...其它规则忽略
{ {
test: /\.css$/, test: /\.css$/,
loader: ExtractTextPlugin.extract({ loader: ExtractTextPlugin.extract({
...@@ -66,10 +66,10 @@ module.exports = { ...@@ -66,10 +66,10 @@ module.exports = {
] ]
}, },
plugins: [ plugins: [
// ...vue-loader plugin omitted // ...vue-loader 插件忽略
new ExtractTextPlugin("style.css") new ExtractTextPlugin("style.css")
] ]
} }
``` ```
Also see [extract-text-webpack-plugin docs](https://github.com/webpack-contrib/extract-text-webpack-plugin). 你也可以查阅 [extract-text-webpack-plugin 文档](https://github.com/webpack-contrib/extract-text-webpack-plugin)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment