Skip to content

Commit

Permalink
Merge pull request #23 from joriewong/master
Browse files Browse the repository at this point in the history
新版本css loader bugfix
  • Loading branch information
zhaoda committed Feb 21, 2017
2 parents f989332 + 005a115 commit c3aea6c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions content/configuration.md
Expand Up @@ -47,7 +47,7 @@ module.exports = {
},
module: {
loaders: [
{test: /\.css$/, loader: 'style!css'}
     {test: /\.css$/, loader: 'style-loader!css-loader'}
]
}
}
Expand All @@ -59,4 +59,4 @@ module.exports = {
require('./style.css')
```

最后运行 `webpack`,可以看到 webpack 通过配置文件执行的结果和上一章节通过命令行 `webpack entry.js bundle.js --module-bind 'css=style!css'` 执行的结果是一样的。
最后运行 `webpack`,可以看到 webpack 通过配置文件执行的结果和上一章节通过命令行 `webpack entry.js bundle.js --module-bind 'css=style-loader!css-loader'` 执行的结果是一样的。
6 changes: 3 additions & 3 deletions content/loader.md
Expand Up @@ -38,7 +38,7 @@ body { background: yellow; }
修改 entry.js:

```js
require("!style!css!./style.css") // 载入 style.css
require("!style-loader!css-loader!./style.css") // 载入 style.css
document.write('It works.')
document.write(require('./module.js'))
```
Expand All @@ -56,10 +56,10 @@ npm install css-loader style-loader
将 entry.js 中的 `require("!style!css!./style.css")` 修改为 `require("./style.css")` ,然后执行:

```bash
$ webpack entry.js bundle.js --module-bind 'css=style!css'
$ webpack entry.js bundle.js --module-bind 'css=style-loader!css-loader'

# 有些环境下可能需要使用双引号
$ webpack entry.js bundle.js --module-bind "css=style!css"
$ webpack entry.js bundle.js --module-bind "css=style-loader!css-loader"
```

显然,这两种使用 loader 的方式,效果是一样的。
4 changes: 2 additions & 2 deletions content/plugin.md
Expand Up @@ -21,7 +21,7 @@ module.exports = {
},
module: {
loaders: [
{test: /\.css$/, loader: 'style!css'}
{test: /\.css$/, loader: 'style-loader!css-loader'}
]
},
plugins: [
Expand All @@ -38,4 +38,4 @@ module.exports = {
/******/ // The module cache
/******/ var installedModules = {};
// 后面代码省略
```
```

0 comments on commit c3aea6c

Please sign in to comment.