webapck编译打包stylus文件

先安装css-loader、stylus、stylus-loader

npm install --save-dev css-loader

npm install --save-dev stylus

npm install --save-dev stylus-loader

webpack.config.js里的配置

 1 module:{
 2     rules:[
 3       {
 4         test: /\.css$/,
 5         use: extractTextPlugin.extract({
 6           fallback: "style-loader",
 7           use: [{loader:"css-loader",options:{importLoaders:1}},'postcss-loader']
 8         })
 9       },     
10       {
11         test: /\.styl(us)?$/,  //注意这块
12         use: extractTextPlugin.extract({
13           use: [{
14             loader: "css-loader"
15           }, {
16             loader: "stylus-loader"
17           }],
18           // use style-loader in development
19           fallback: "style-loader"
20         })
21       }
22     ]
23   }

 

posted @ 2018-01-19 21:40  zhaobao1830  阅读(149)  评论(0编辑  收藏  举报