ashpink
ashpink

Reputation: 43

why nuxt.js global css on config is not working?

I try to put css files on assets assest/css/style.css and call it to my nuxt.config.js but it is not working i need to use global css not scoped css

can someone help me?

when i add css in the nuxt.config.js

   /*
  ** Global CSS
  */
  css: [
      '~assets/css/style.css'
  ],

its not working ? nuxt version 2

Upvotes: 4

Views: 10513

Answers (2)

Riza Khan
Riza Khan

Reputation: 3158

Simply restart the server. Adding the code to the module should not be necessary.

Upvotes: 2

David Cortizo
David Cortizo

Reputation: 86

I came across the same issue and solved it putting the file path to my css inside the css options and inside modules. Example code below. Hope it helps. I'm also using nuxt-sass-resources-loader to load my sass files globally.

css: [
  '@/assets/css/reset.css',
  '@/assets/css/main.scss',
],
modules: [
 [
  'nuxt-sass-resources-loader',
  ['./assets/css/main.scss'],
  ['./assets/css/reset.css']
 ]
],

Upvotes: 7

Related Questions