我正在使用 ZURB Foundation CLI,但我不知道如何从 node-modules 文件夹中导入 css/scss 文件。
Below is my config. You can use mini-css-extract-plugin to extract css you import into js into seperate css file like this
You can view my full source here
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css"
})
],
module: {
rules: [{
test: /\.scss$/,
use: [
'style-loader',
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
minimize: true,
sourceMap: true
}
},
{
loader: "sass-loader"
}
]
}
]
}
};
Then in my js I import something like this
import "css/Admin/admin.scss";
Whenever I run webpack --watch
command I will have admin.css
file base on scss file
也许您可以在 main.js 文件中尝试诸如import 'swiper/css/swiper.css'
的东西。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.