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

六月ゝ 毕业季﹏ 提交于 2020-08-26 04:19:11

问题


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


回答1:


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']
 ]
],



回答2:


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



来源:https://stackoverflow.com/questions/53236783/why-nuxt-js-global-css-on-config-is-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!