carbon-design-system / carbon-components-vue

Vue implementation of the Carbon Design System
http://vue.carbondesignsystem.com
Apache License 2.0
608 stars 178 forks source link

How to override carbon scss values like prefix globally in a vue app? #1054

Closed jaskiratr closed 3 days ago

jaskiratr commented 3 years ago

What package(s) are you using?

Summary

In a Vue app, I am unable to set the prefix value for the imported carbon scss styles as described in the documentation. https://github.com/carbon-design-system/carbon/blob/master/docs/guides/sass.md#prefixes

Relevant information

I defined overrides in a separate .scss file and imported it in main.js of the Vue app. It is the first import in the file but the prefix doesn't update.

https://codesandbox.io/s/romantic-heyrovsky-7m3c0?file=/src/main.js

// main.js
import Vue from "vue";
import App from "./App.vue";

import "./_cv-override.scss";

import "carbon-components/scss/components/button/_button.scss";
import "carbon-components/scss/components/tooltip/_tooltip.scss";

import {
  CvButton,
  CvIconButton,
  CvButtonSkeleton,
  CvButtonSet
} from "@carbon/vue";

Vue.component("CvButton", CvButton);
Vue.component("CvIconButton", CvIconButton);
Vue.component("CvButtonSkeleton", CvButtonSkeleton);
Vue.component("CvButtonSet", CvButtonSet);

Vue.config.productionTip = false;

new Vue({
  render: (h) => h(App)
}).$mount("#app");
// _cv-override.scss
$prefix : 'sds';

Not certain what is the proper way to update the prefix and set feature flags in a Vue application. Any advice would be greatly appreciated!

Thanks for building an incredible design system!

github-actions[bot] commented 3 months ago

This issue has been marked as stale because it has required additional info or a response from the author for over 14 days. When you get the chance, please comment with the additional info requested. Otherwise, this issue will be closed in 14 days.

github-actions[bot] commented 3 days ago

This issue has been closed because it has received no activity for 28 days.