A
A
Andrew2019-12-03 18:34:29
Sass
Andrew, 2019-12-03 18:34:29

Can't see global sass variables in nuxt?

Connected sass styles globally via css property in nuxt.config.js

css: [
        '@/assets/style/global.sass'
    ],

Everything works fine, global styles are applied, classes can be used, but for the life of me, it does not see variables.
I tried other methods, but nothing works at all through them:
modules: [
        [
            'nuxt-sass-resources-loader', 
            [
                'assets/style/global.sass'
            ]
        ]
    ],

// Или способ через style-resources
styleResources: {
    sass: [
      '@/assets/style/main.sass'
    ]
  },
modules: [
    '@nuxtjs/style-resources'
]

Moreover, the latter (style resources) was copied from another project and it was the other way around: the variables worked, but classes and global styles did not cling. Magic)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Suha, 2019-12-03
@andreysuha

I connected like this

{
                            loader: "sass-loader",
                            options: {
                                sourceMap: true,
                                data: `
                                    @import "@scss/_variables.scss";
                                    @import "@scss/_functions.scss";
                                    @import "@scss/_mixins.scss";
                                `
                            }
                        }

The truth is not in nuxt, but I think this is not essential

D
Domovikx, 2020-06-17
@Domovikx

5eea1acc39e09334649904.png
5eea1b432ee2e137936018.png
5eea1bda4fe2e969772570.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question