O
O
olezhenka2018-02-27 17:54:18
Sass
olezhenka, 2018-02-27 17:54:18

How to make all scss files autostart another scss in nuxt?

Where to put the configuration in the nuxt.config file so that the scss compiler first runs the file with scss variables and only then compiles the desired file?
For everywhere to write @import('../../assets/plugins/_var.scss'); not so cool...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
olezhenka, 2018-02-27
@olezhenka

Solution:
There is a plugin for nuxt itself - nuxt-sass-resources-loader
// nuxt.config.js

modules: [
    'nuxt-sass-resources-loader'
  ],
  sassResources: [
    resolve(__dirname, 'assets/_colors.scss')
  ],

E
Egor Zhivagin, 2018-02-27
@Krasnodar_etc

Make an index.scss file into
it:

import '../../_var.scss';
import '../my.scss';
import 'huihui.scss';
...

Well, just import all the files. Feed the collector only this file. Mustache.
PS - I don’t rummage in webpack-e, but a colleague on the project set it up so that instead of a long ../../../ ... you can simply write @assets, @components, ... Google it, it’s really pleasing

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question