IvanS95
IvanS95

Reputation: 5732

How to get CSS IntelliSense to work on a Nuxt project?

I'm working on a Nuxt.js Project, I created a Docker image as well to handle everything; I'm also trying to include MDBVue as a CSS library, after reading I understand that in order to use this I have to include it as a plugin and reference it on my nuxt.config.js file;

This is how my file looks:

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)/
        })
      }
    }
  }
}

Now the CSS classes work, but I'm not able to get any autocompletion from VSCode, I have to type in the full class name; is this normal behavior or is there a way to get IntelliSense to work on my Vue files?

Upvotes: 0

Views: 2600

Answers (1)

Bob Fanger
Bob Fanger

Reputation: 29897

This is the normal behaviour: https://github.com/Microsoft/vscode/issues/27635

Try the plugin:

IntelliSense for CSS class names in HTML
  or
HTML CSS Support

Source: https://code.visualstudio.com/docs/languages/css

And of course Vetur a must-have plugin for vue development in vscode.

Upvotes: 3

Related Questions