【问题标题】:How to get CSS IntelliSense to work on a Nuxt project?如何让 CSS IntelliSense 在 Nuxt 项目上工作?
【发布时间】:2019-03-18 17:16:23
【问题描述】:

我正在开发一个 Nuxt.js 项目,我还创建了一个 Docker 映像来处理所有事情;我还试图将MDBVue 包含为 CSS 库,在阅读后我了解到,为了使用它,我必须将它作为插件包含并在我的 nuxt.config.js 文件中引用它;

这是我的文件的样子:

module.exports = {
  /*
  ** Headers of the page
  */
  head: {
    title: 'skfe',
    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' },
  css: [
    { src: "bootstrap-css-only/css/bootstrap.min.css" },
    { src: "mdbvue/build/css/mdb.css" }
  ],
  /*
  ** 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 类可以工作了,但我无法从 VSCode 获得任何自动完成功能,我必须输入完整的类名;这是正常行为还是有办法让 IntelliSense 处理我的 Vue 文件?

【问题讨论】:

    标签: css vue.js visual-studio-code intellisense nuxt.js


    【解决方案1】:

    这是正常行为: https://github.com/Microsoft/vscode/issues/27635

    试试插件:

    IntelliSense for CSS class names in HTML

    HTML CSS Support

    来源:https://code.visualstudio.com/docs/languages/css

    当然还有Vetur 是vscode 中vue 开发的必备插件。

    【讨论】:

    • 是的,我也在使用 Vetur,我会尝试安装其他扩展
    猜你喜欢
    • 2021-04-05
    • 1970-01-01
    • 2021-04-21
    • 2018-07-24
    • 1970-01-01
    • 2017-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多