A
A
Alexander Ivanov2019-01-14 10:15:02
webpack
Alexander Ivanov, 2019-01-14 10:15:02

How to include scss in vue.config.js?

const path = require('path')

function resolve (dir) {
    return path.join(__dirname, dir)
}

module.exports = {
    chainWebpack: config => {
        config.resolve.alias
            .set('@', resolve('src'))
    }, 
    css: {
        loaderOptions: {
            sass: {
                data: `@import "@/scss/settings.scss";`
                //data: `@import "/src/scss/settings.scss";`
                //data: `@import "./src/scss/settings.scss";`
            }
        }
    }
}

The vue.config.js configuration file differs from the standard webpack, like the example below did
https://cli.vuejs.org/guide/css.html#passing-optio...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Ivanov, 2019-01-14
@cimonlebedev

While added to app.vue

<style lang="scss">
   @import '@/scss/settings.scss';
</style>

But something seems to me that it should connect via webpack

W
wergbitsky, 2019-06-17
@wergbitsky

https://cli.vuejs.org/ru/guide/css.html#css-%D0%BC...
there is a lot on your question

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question