using lib-flexible + px2rem-loader, to introduce css externally in Vue
<style src="../assets/style.css">
/* */
</style>
<style>
@import url("../assets/style.css");
/* */
</style>
<style>
@import "../assets/style.css";
/* */
</style>
has tried to configure importLoaders
depth as suggested in @ Bingyang vue-cli , with depth levels ranging from 1-10
to invalid
.
utils.js
configuration
const cssLoader = {
loader: "css-loader",
options: {
sourceMap: options.sourceMap,
importLoaders: 10
}
}
const px2remLoader = {
loader: "px2rem-loader",
options:{
remUnit:75
}
}
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader,px2remLoader]
if (loader) {
loaders.push({
loader: loader + "-loader",
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
invalid solution: (at present, this approach seems to be the most reliable, but ineffective)
how to make the style introduced in @ import
mode successfully converted into rem, by px2rem-loader
. Thank you, Gods.