Answer a question

At my company we are not writing css in Vue files, we prefer to do it the old way with SCSS.

Problem is, we end up with a need of writing new import in styles.scss any time we create new component, and it really bugs me in bigger projects.

Not so long ago, when I have been developing in React, I imported module called node-sass-glob-importer in webpack.config file, tweaked a bit (you can check here) and it worked - I could have imported folder like this: @import "components/**";

In Nuxt, I only have nuxt.config.js file and I am lost a bit. I know how to extend some simple stuff there, but this seems to be more complicated.

Any help of importing node-sass-glob-importer or doing the same thing in some other way?

Answers

how about using https://github.com/nuxt-community/style-resources-module and than:

export default {
  modules: ['@nuxtjs/style-resources'],
  styleResources: {
    scss: [
      './assets/yourFolder/*.scss'
    ]
  }
}
Logo

前往低代码交流专区

更多推荐