webpack把各個模組的css打包成一個方法:
webpack.config.js配置如下
var ExtractTextPlugin = require("extract-text-webpack-plugin");//extract-text-webpack-plugin安裝此外掛
module:{
loaders:[
{test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader")}
]
},
plugins:[
new ExtractTextPlugin("css/[name].css")//則會生成一個css檔案
比如你的js檔案中這樣引入即可:
import "./css/lib/bootstrap.min.css"
import "./css/test.css";
webpack把各個模組的css打包成一個方法:
webpack.config.js配置如下
var ExtractTextPlugin = require("extract-text-webpack-plugin");//extract-text-webpack-plugin安裝此外掛
module:{
loaders:[
{test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader")}
]
},
plugins:[
new ExtractTextPlugin("css/[name].css")//則會生成一個css檔案
]
比如你的js檔案中這樣引入即可:
import "./css/lib/bootstrap.min.css"
import "./css/test.css";