How to use Bootstrap mixins in VueJS components

隐身守侯 提交于 2019-12-02 02:51:51

I figure it out. In case youre using vue-cli:

Create file vue.config.js with content:

const path = require("path");
const loader = {
    loader: 'sass-resources-loader',
    options: {
      resources: path.resolve(__dirname, './src/assets/scss/global.scss')
    }
}

module.exports = {
    configureWebpack: {
        module: {
            rules: [
            {
                test: /\.scss$/,
                use: [
                loader,
                'sass-loader'
                ]
            }
            ]
        }
    }
};

Don't forget to install sass-resources-loader:

yarn add sass-resources-loader -D

And restart dev server. So from now you can define/import variables, mixins and other stuff inside that global.scss and these variables/mixins will be available inside every component without import.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!