Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change default font in vuetify is not working (vue-cli 3) [Vuetify 1.X]

I'm aware of the question change-default-font-in-vuetify in SO, but it doesn't address my problem as it was posted before vue-cli-3 came out, so the ideas there don't apply here as that, the official docs from Vuetify on how to change themes and other options don't have any valid step for when the project is created with vue-cli 3.

So far my attempts go like this:

  • vue create fooproject (using default config, but even if I don't use the default but cherrypick what I want in the project and select the css-preprocessor as stylus manually it won't work)

  • vue add vuetify

  • it creates a plugin dir: src/plugins, where it stores vuetify.js

  • add a v-btn in the HelloWorld component just for knowing if the font had effect

  • Then I should be able to import ../stylus/main.styl, where I have:

    @import '~vuetify/src/stylus/settings/_variables' $body-font-family = 'Open Sans', sans-serif; $heading-font-family = 'Montserrat', sans-serif; @import '~vuetify/src/stylus/main'

I even tried with @import '~vuetify/src/stylus/main' , do I have to do also vue add additional stylus-loader dependencies or anything plus? Because that's exactly what it's NOT recommended on Vuetify's website.

Error log: no errors, I just keep seing Roboto font in my material buttons

Any remarks?

Other attempts: I tried to follow the steps written by Jacob E. Dawson but I'm missing something super silly probably.

Edit: the linked article from medium at the time didn't specify it was not scoped to a specific Vue version as of September 2019.

like image 449
sab Avatar asked Nov 07 '18 14:11

sab


1 Answers

So I just took a quick and fresh glance back to this, at the end it was something silly, if a project is created with vue-cli 3 (either custom choices or default), then obviously in the component App.vue I had to take out font-family from the style section as it overwrites the CSS:

#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif; /* this was it */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
like image 102
sab Avatar answered Oct 18 '22 14:10

sab