代码之家  ›  专栏  ›  技术社区  ›  localhost

将css文件url添加到nuxt。配置。js

  •  1
  • localhost  · 技术社区  · 8 年前

    我正在尝试添加我自己的CSS,它由Sass的输出组成,但我不知道如何按照文档所说的那样添加

    module.exports = {
      css: [
        // Load a Node.js module directly (here it's a Sass file)
        'bulma',
        // CSS file in the project
        '@/assets/css/main.css',
        // SCSS file in the project
        '@/assets/css/main.scss'
      ]
    }
    

    但当我打开nuxt时。配置。我发现下面的格式完全不同

    module.exports = {
      /*
      ** Headers of the page
      */
      head: {
        title: 'nexus',
        meta: [
          { charset: 'utf-8' },
          { name: 'viewport', content: 'width=device-width, initial-scale=1' },
          { hid: 'description', name: 'description', content: 'Nuxt.js project' }
        ],
        link: [
          { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
        ]
      },
      /*
      ** Customize the progress bar color
      */
      loading: { color: '#3B8070' },
      /*
      ** Build configuration
      */
      build: {
        /*
        ** Run ESLint on save
        */
        extend (config, { isDev, isClient }) {
          if (isDev && isClient) {
            config.module.rules.push({
              enforce: 'pre',
              test: /\.(js|vue)$/,
              loader: 'eslint-loader',
              exclude: /(node_modules)/
            })
          }
        }
      }
    }
    

    如何将自己的css链接添加到该文件?

    1 回复  |  直到 8 年前
        1
  •  0
  •   Aldarund    8 年前

    有什么不同?您只需要将css部分添加到nuxt。配置。如果你想通过nuxt/webpack来处理你的css。

    如果你只想在头部添加静态css文件,你可以在头部部分添加。

    推荐文章