Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Resource Scope #185

Open
rizqirizqi opened this issue Sep 20, 2021 · 0 comments
Open

Feature Request: Resource Scope #185

rizqirizqi opened this issue Sep 20, 2021 · 0 comments

Comments

@rizqirizqi
Copy link

Problem

I have a use case where I need to separate scss variables to become modular. With the current implementation, if I have two files and there are conflicting variables, I can't do anything to make it work together while using this package.

Proposal

nuxt.config.js:

export default {
  buildModules: ['@nuxtjs/style-resources'],
  styleResources: {
    scss: { // allow object as config and use the key as module name
      foo: './assets/foo/vars/*.scss',
      bar: './assets/bar/vars/*.scss',
    },
  },
}

assets/foo/vars/_colors.scss:

$gray: #333;

assets/bar/vars/_colors.scss:

$gray: #444;

components/Test.vue:

<template>
  <div class="something">Test</div>
</template>

<style lang="scss">
  .something {
    color: $foo-gray; // will be resolved to #333
  }
</style>

components/AnotherTest.vue:

<template>
  <div class="anotherthing">Test</div>
</template>

<style lang="scss">
  .anotherthing {
    color: $bar-gray; // will be resolved to #444
  }
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant