First of all it's probably not a good idea to import those global styles per component. Every time you @import
the vuetify's stylesheets get added to your generated code. Actually, using @import
is generally discouraged, check Heads up from Sass to see why.
But going with your code snippet, your override of $btn-text-transform
can't work because you are using !default
in your assignment. It won't assign the value since the value got assigned in the imported stylesheet already.
So get rid of the !default
. If that alone doesn't work, move the $btn-text-transform
declaration up above the @import
.
Edit 18-08-21 How to override SASS variable vuetify in component:
You can override the Sass variables only there where you import the stylesheet using those. If you eg. import (directly or transitively) ~vuetify/src/components/VBtn/_variables.scss
into your global stylesheet and then in your component (a separate stylesheet) you want to change $btn-text-transform
, it won't work.
That's because of how Sass variables work - they exist only in compilation time. That, and the fact that the compilation scope of your component's styles is separate from the global stylesheet (if we go with the example above) means that changing, well actually declaring a new $btn-text-transform
in your component's styles has no effect on the global stylesheet's compilation. That compilation might have already finished before your component's styles even begin to compile.
Your approach would work if you imported VBtn styles into your component like this:
@import "~vuetify/src/components/VBtn/_variables.scss";
$btn-text-transform: [your-own-value];
@import "~vuetify/src/components/VBtn/VBtn.sass";
And ideally you wouldn't import VBtn styles anywhere else. If you did, eg. in some global stylesheet, there would be style duplication which would mean less predictability to which styles get applied and more bytes that'd need to be sent to the client.
But that might be too much hustle. The easiest way to customize the styles locally is to import all the vuetify's styles you need globally and then in your component apply your own, scoped style changes. Talking about the text-transform
you want to change, you can just use this in your component's styles:
<style scoped>
/deep/ .v-btn {
text-transform: [your-own-value];
}
</style>