Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailwind CSS IntelliSense Extension not working! #247

Closed
anburocky3 opened this issue Jan 16, 2021 · 38 comments
Closed

Tailwind CSS IntelliSense Extension not working! #247

anburocky3 opened this issue Jan 16, 2021 · 38 comments
Assignees
Labels
enhancement New feature or request

Comments

@anburocky3
Copy link

I also generated the tailwind.config.js but still it's not working.. Why is that?

@anburocky3 anburocky3 added the question Further information is requested label Jan 16, 2021
@Geminii
Copy link
Contributor

Geminii commented Jan 16, 2021

I also generated the tailwind.config.js but still it's not working.. Why is that?

I don't understand the problem you are having because the problem is located on the IntelliSense plugin.
Or do you create tailwind.config.js and this one isn't apply to your nuxt project 🤔
I'm using Tailwind CSS IntelliSense Extension on my vscode and i don't have any project about it.

@anburocky3
Copy link
Author

I also generated the tailwind.config.js but still it's not working.. Why is that?

I don't understand the problem you are having because the problem is located on the IntelliSense plugin.
Or do you create tailwind.config.js and this one isn't apply to your nuxt project
I'm using Tailwind CSS IntelliSense Extension on my vscode and i don't have any project about it.

Using tailwindcss-module in your nuxt problem? I'm having problem with the intellisense, the classes names are not suggesting for me.

@Geminii
Copy link
Contributor

Geminii commented Jan 16, 2021

Default classes or you extend some of them ? Can you provide screen or your config ?
Need more information for help

@anburocky3
Copy link
Author

Not extending, using the inbuilt default.

Here is the tailwind.config.js

module.exports = {
  purge: {
    enabled: process.env.NODE_ENV === 'production',
    content: [
      'components/**/*.vue',
      'layouts/**/*.vue',
      'pages/**/*.vue',
      'plugins/**/*.js',
      'nuxt.config.js',
      // TypeScript
      'plugins/**/*.ts',
      'nuxt.config.ts'
    ]
  },
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [],
}

Copy link
Collaborator

Atinux commented Jan 17, 2021

Try restarting your VS Code and see if the problem still occurs

@anburocky3
Copy link
Author

Tried restarting the VSCode, Still the same problem.

As a workaround, I installed it: https://marketplace.visualstudio.com/items?itemName=Zignd.html-css-class-completion and it was working after a couple of mins.

Is it a bug? @Atinux

Copy link
Collaborator

Atinux commented Jan 17, 2021

I don’t know, if works for all my projects using it 🤔

@bluskript
Copy link

bluskript commented Jan 18, 2021

I have the same issue.
UPDATE:
looked in VSCode's 'Output' for the extension:

Failed to initialise: /Users/HIDDEN/HarmonyProject/tempest/tailwind.config.js:1
import colors from 'tailwindcss/colors'
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Module._compile (internal/modules/cjs/loader.js:942:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1051:10)
    at Module.load (internal/modules/cjs/loader.js:862:32)
    at Module._load (internal/modules/cjs/loader.js:774:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Module.require (internal/modules/cjs/loader.js:899:19)
    at Module._require.h.a.require (/Users/HIDDEN/.vscode/extensions/bradlc.vscode-tailwindcss-0.5.7/dist/server/index.js:13:155396)
    at require (internal/modules/cjs/helpers.js:74:18)
    at n (/Users/HIDDEN/.vscode/extensions/bradlc.vscode-tailwindcss-0.5.7/dist/server/index.js:13:161485)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
(node:62654) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'classNames' of undefined
    at Te (/Users/HIDDEN/.vscode/extensions/bradlc.vscode-tailwindcss-0.5.7/dist/server/index.js:13:116506)
    at Ge (/Users/HIDDEN/.vscode/extensions/bradlc.vscode-tailwindcss-0.5.7/dist/server/index.js:13:123887)
    at /Users/HIDDEN/.vscode/extensions/bradlc.vscode-tailwindcss-0.5.7/dist/server/index.js:13:124236
    at Array.forEach (<anonymous>)
    at /Users/HIDDEN/.vscode/extensions/bradlc.vscode-tailwindcss-0.5.7/dist/server/index.js:13:124207
    at Array.forEach (<anonymous>)
    at /Users/HIDDEN/.vscode/extensions/bradlc.vscode-tailwindcss-0.5.7/dist/server/index.js:13:124172
(node:62654) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:62654) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Yep -- after changing the import to require, it works now. Kinda a dumb mistake on my part.

@anburocky3
Copy link
Author

I'm not using any import inside the tailwind.config.js just using the default config file. but still experiencing the problem :/

@bluskript
Copy link

bluskript commented Jan 18, 2021

Look at the VSCode's Output tab for the tailwind autocomplete extension. That gives some useful info.

@flozero
Copy link

flozero commented Jan 24, 2021

I have the same issue a lot. I have to deactivate and reactivate the plugins every time. I don't know if it's related to the module

@anburocky3
Copy link
Author

There is no output logs. But it's not working either.. :/ I'm using this extension in order to work.
https://marketplace.visualstudio.com/items?itemName=Zignd.html-css-class-completion

@jamiecarter7
Copy link

I'm having a similar issue, though its a great way to really learn the syntax it makes it a little less fun to use.

Copy link
Collaborator

Atinux commented Feb 2, 2021

@jamiecarter7 even after creating the tailwind.config.js file?

@jamiecarter7
Copy link

jamiecarter7 commented Feb 2, 2021 via email

Copy link
Collaborator

Atinux commented Feb 2, 2021

Try to run npx tailwind init

@jamiecarter7
Copy link

jamiecarter7 commented Feb 2, 2021 via email

Copy link
Collaborator

Atinux commented Feb 2, 2021

I believe we shall keep creating the tailwind.config.js file in order to keep intellisense working: https://github.com/tailwindlabs/tailwindcss-intellisense#troubleshooting

Or at least, in our setup documentation, adding a note here about running npx tailwind init to have intellisense working.

PR welcome <3

@anburocky3
Copy link
Author

As a temporary fix: Do the following, until they fix the problem:

  1. Create tailwind.config.js file or better do npx tailwind init in your terminal, it should create tailwind.config.js
  2. Restart the VSCode. Now it should work. :)

@IgnisDa
Copy link

IgnisDa commented Mar 4, 2021

As a temporary fix: Do the following, until they fix the problem:

  1. Create tailwind.config.js file or better do npx tailwind init in your terminal, it should create tailwind.config.js
  2. Restart the VSCode. Now it should work. :)

This is not an issue. The tailwind css VSCode extension is activated only if it detects a tailwind.config.js in the workspace. Once it detects it, just restart VSCode for the changes to take effect.

@anburocky3
Copy link
Author

As a temporary fix: Do the following, until they fix the problem:

  1. Create tailwind.config.js file or better do npx tailwind init in your terminal, it should create tailwind.config.js
  2. Restart the VSCode. Now it should work. :)

This is not an issue. The tailwind css VSCode extension is activated only if it detects a tailwind.config.js in the workspace. Once it detects it, just restart VSCode for the changes to take effect.

If we want the tailwind css intellisense support we have to do the manual tweak(creating the tailwind.config.js) right. This workflow can be improved by nuxt or tailwind side :) That's my suggestion.

@IgnisDa
Copy link

IgnisDa commented Mar 4, 2021

IMO that workflow might be detrimental to others. For example, if I have the Tailwind extension installed but am not actually using tailwind in my project, the popups from the extension will only make it more difficult to code and create useless clutter. Moreover, since almost all projects need to define a custom tailwind.config.js, its really a non-issue.

This workflow can be improved by nuxt or tailwind side

I agree with this. Maybe yarn add --dev @nuxtjs/tailwindcss can automatically setup a default file (for example run npx tailwind init under the hood?)

Copy link
Collaborator

Atinux commented Mar 8, 2021

We are planning to generate a .nuxt/tailwind.config.js automatically so the VS Code extension will work seamlessly.

@Atinux Atinux self-assigned this Mar 8, 2021
@Atinux Atinux added enhancement New feature or request and removed question Further information is requested labels Mar 8, 2021 — with Volta.net
@saymo23
Copy link

saymo23 commented Mar 11, 2021

I followed this guide but without installing nuxt with tailwind in the CLI, I installed it with npm and it worked for me.

https://tailwindcss.com/docs/guides/nuxtjs

@HusamElbashir
Copy link

Was having this issue after an upgrade and it turned out that for some reason I was missing the tailwindcss module in my workspace. Got around it by installing it as a devDependency.

https://github.com/tailwindlabs/tailwindcss-intellisense#troubleshooting

@Atinux Atinux closed this as completed May 12, 2021
@yaolinhong
Copy link

npx tailwindcss init
it works for me

@EMurrell
Copy link

I really struggled with this one, and tried so many suggested fixes. At the end of the day, i installed the previous version of Tailwind CSS IntelliSense extension and now works fine.

@Asef00
Copy link

Asef00 commented Jul 26, 2022

npx tailwindcss init worked out. But I already had a tailwind.config.ts file:

import { Config } from 'tailwindcss';

export default <typeof Config>{
  content: [],
  theme: {
    extend: {
      spacing: {
        '68': '17rem',
      },
      fontFamily: {
        'montserrat': 'Montserrat'
      },
      colors: {
        'bluegrey': '#9aabc5',
        'primary': '#3144c4'
      }
    },
  },
  plugins: [],
}

It looks like the one with the .js should exist.

@dvlden
Copy link

dvlden commented Oct 9, 2022

TailwindCSS extension for VS Code provides a settings option:
tailwindCSS.experimental.configFile, but unfortunately doesn't play well with .ts config.

SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'

So I suggest sticking with tailwind.config.cjs, it will work in a similar fashion.

@yousefomar724
Copy link

yousefomar724 commented Oct 11, 2022

I found that Intellisense for the extension will not work with single quotes, If I use double quotes in my classNames, the intellisense works fine.

The solution for me was to update my settings.json to include

"prettier.jsxSingleQuote": false,
"prettier.singleQuote": false,

@mahendrameghwal
Copy link

tw

only you just create empty this file your Tailwind CSS IntelliSense extension work properly

@wilfredinni
Copy link

Same issue with Nuxt 3 stable, nothing of the above works...

@wilfredinni
Copy link

wilfredinni commented Dec 15, 2022

Same issue with Nuxt 3 stable, nothing of the above works...

I downgraded the tailwind intellisense plugin to version 0.9.1 and everything worked as expected

Copy link
Collaborator

Atinux commented Dec 16, 2022

@wilfredinni
Copy link

Have you tried https://tailwindcss.nuxt.dev/tailwind/editor-support ?

Yes, but it was a bug with the tailwind intellisense plugin (I don't have the link right now), all worked out fine with version 0.9.1

@jamaluddinrumi
Copy link

jamaluddinrumi commented Dec 21, 2022

Have you tried https://tailwindcss.nuxt.dev/tailwind/editor-support ?

indeed, disabling .nuxt/tailwind.config.cjs & exclude .nuxt from intellisense inspection make it works

  "tailwindCSS.files.exclude": [
    "**/.git/**",
    "**/node_modules/**",
    "**/.hg/**",
    "**/.svn/**",
+   "**/.nuxt/**"
  ]

tailwindlabs/tailwindcss-intellisense#663 (comment)

@huzaifahj
Copy link

It doesn't say anything about the above in the documentation

@ahmdsfdn
Copy link

ahmdsfdn commented May 9, 2023

Have you tried https://tailwindcss.nuxt.dev/tailwind/editor-support ?

indeed, disabling .nuxt/tailwind.config.cjs & exclude .nuxt from intellisense inspection make it works

  "tailwindCSS.files.exclude": [
    "**/.git/**",
    "**/node_modules/**",
    "**/.hg/**",
    "**/.svn/**",
+   "**/.nuxt/**"
  ]

tailwindlabs/tailwindcss-intellisense#663 (comment)

it's work for my nuxt 3 project, ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests