Home

Issue: 387

Global Sass mixins and functions

[issue link]

It seems that only compiled CSS is available globally.

For example, something like this included globally would work:

// assets/scss/main

@mixin createGrid() { ... }

.container {
  @include createGrid()
}

But this wouldn’t work:

// assets/scss/main

@mixin createGrid() { ... }

// components/someComponent

.container {
  @include createGrid()
}

Would it be possible to inject sass mixins and functions globally? Or is there a reason they need to be imported individually for each file/component?

If the latter, another alternative would be to have sass @import statements resolve node_modules so that components that use them don’t all have to do @import 'node_modules/somePlugin/dist/someFile'.

This question is available on Nuxt.js community (#c333)