<style lang="sass" scoped>
.title
font-size: 50px
font-family: Arial
font-weight: 500
color: red
</style>
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { VueLoaderPlugin } = require('vue-loader');
module: {
rules: [{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loader: {
sass: 'vue-style-loader!css-loader!sass-loader'
}
}
},{
test: /\.sass$/,
use: [
'style-loader',
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: { sourceMap: true }
}, {
loader: 'postcss-loader',
options: { sourceMap: true, config: { path: './postcss.config.js' } }
}, {
loader: 'sass-loader',
options: { sourceMap: true }
}
]
}, {
test: /\.css$/,
use: [
'style-loader',
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: { sourceMap: true }
}, {
loader: 'postcss-loader',
options: { sourceMap: true, config: { path: `./postcss.config.js` } }
}
]
}
]
},
plugins: [
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
filename: `${PATHS.assets}css/[name].[hash].css`,
}),
]
}
module.exports = {
plugins: [
require('autoprefixer'),
require('css-mqpacker'),
require('cssnano')({
preset: [
'default', {
discardComments: {
removeAll: true,
}
}
]
})
]
}
.title {
font-size: 50px;
font-family: Arial;
font-weight: 500;
color: red;
}
module.exports = {
css: {
loaderOptions: {
sass: {
prependData: ` @import '@/assets/sass/_theme.scss';`
}
}
},
}
npm update -g @vue/cli
# OR
yarn global upgrade --latest @vue/cli
npm update sass-loader
# OR
yarn upgrade --latest sass-loader
module.exports = {
css: {
loaderOptions: {
// old
sass: {
data: `@import "@/styles/_global.scss";`,
},
// new
sass: {
prependData: `@import "@/styles/_global.sass"`, // change to *.sass; remove semi-colon
},
scss: { // separate one for scss
prependData: `@import "@/styles/_global.scss"`, // this is .scss
},
},
},
// ...
}
module.exports = {
css: {
loaderOptions: {
sass: {
sassOptions: {
includePaths: [
'./node_modules'
]
},
prependData: `@import "@/styles/global.scss";`,
},
},
},
};
sass-loader не работает с версией 8.0.0. и vue cli 3.10.0