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

Problem with nuxt + vuestic + tailwind, can't change font #4213

Closed
lokize opened this issue Apr 5, 2024 · 4 comments
Closed

Problem with nuxt + vuestic + tailwind, can't change font #4213

lokize opened this issue Apr 5, 2024 · 4 comments
Assignees
Labels
BUG Something isn't working

Comments

@lokize
Copy link

lokize commented Apr 5, 2024

Vuestic-ui version: 1.9.8

Description

i cant change font of my application, when i use this config:

vuestic: {
    config: {
      // Config here
    },
    fonts: false,

    //css: ["typography", "reset"],
  },

in nuxt.config.ts my font still is sans-serif, i cant import and use another font in my application when i using Vuestic, if i disabled Vuestic the import of another font works good.

@lokize lokize added the BUG Something isn't working label Apr 5, 2024
@lokize lokize changed the title Problem with nuxt + vuestic + tailwind, cant change font Problem with nuxt + vuestic + tailwind, can't change font Apr 5, 2024
@m0ksem
Copy link
Contributor

m0ksem commented Apr 6, 2024

Have you tried to set --va-font-familly css variable to another font?

@lokize
Copy link
Author

lokize commented Apr 6, 2024

how to do that? i have a imported font in my default.css:

@font-face {
  font-family: Inter;
  src: url(~/assets/fonts/Inter-Regular.ttf);
}

body {
  font-family: Inter;
}

and imported this in nuxt.config:

  devtools: { enabled: true },
  css: ["~/assets/css/default.css", "~/assets/css/tailwind.css"],
  vuestic: {
    config: {
      // Config here
    },
    fonts: true,

    //css: ["typography", "reset"],
  },
  modules: [
    "nuxt-icon",
    "@nuxtjs/tailwindcss",
    "@vuestic/nuxt",
    //"@nuxtjs/sitemap",
    "@nuxtjs/seo",
  ],
});

if vuestic is disabled in nuxt config font imported worked well

@cybearz
Copy link
Contributor

cybearz commented Apr 6, 2024

Yes, I have the same problem. Found what the issue is. Will make a PR soon.

cybearz pushed a commit to cybearz/vuestic-ui that referenced this issue Apr 6, 2024
Vuestic's option "css" accepts an array of  css modules as an input. The default value of that option is ['smart-helpers', 'typography'].
The problem is that nuxt won't override the default array with an array passed by user (it's a known issue). Instaed two arrays will be concatenated.
For example, I want to use only a typography css module, so I set the css option to ['typography']. In that case useVuesticCSS method wil receive ['smart-helpers', 'typography', 'typography'] and not just ['typography']
@m0ksem
Copy link
Contributor

m0ksem commented Apr 8, 2024

how to do that? i have a imported font in my default.css:

@font-face {
  font-family: Inter;
  src: url(~/assets/fonts/Inter-Regular.ttf);
}

body {
  font-family: Inter;
}

and imported this in nuxt.config:

  devtools: { enabled: true },
  css: ["~/assets/css/default.css", "~/assets/css/tailwind.css"],
  vuestic: {
    config: {
      // Config here
    },
    fonts: true,

    //css: ["typography", "reset"],
  },
  modules: [
    "nuxt-icon",
    "@nuxtjs/tailwindcss",
    "@vuestic/nuxt",
    //"@nuxtjs/sitemap",
    "@nuxtjs/seo",
  ],
});

if vuestic is disabled in nuxt config font imported worked well

@lokize, Add to your default.css

body {
   --va-font-family: Inter;
}

Even if typography css module is disabled, components still will try to use Source Sans Pro if it is available. This is why you still need to override --va-font-family css variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Something isn't working
Development

No branches or pull requests

3 participants