Skip to content
New issue

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

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

Already on GitHub? # to your account

Vue-Nuxt Hot reloading JIT mode does not work via Nuxt Module comments #4962

Closed
productdevbook opened this issue Jul 13, 2021 · 5 comments
Closed

Comments

@productdevbook
Copy link

What version of Tailwind CSS are you using?

2.2.4

What build tool (or framework if it abstracts the build tool) are you using?

nuxt 2.15.6

What version of Node.js are you using?

node 14

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction repository

nuxt-modules/tailwindcss#357 (comment)

Describe your issue

Reproduction1: nuxt-modules/tailwindcss#357 (comment)

Reproduction2: nuxt-modules/tailwindcss#357 (comment)

I also live in my own project.

@productdevbook productdevbook changed the title Vue-Nuxt Hot reloading does not work via Nuxt Module comments Vue-Nuxt Hot reloading JIT mode does not work via Nuxt Module comments Jul 13, 2021
@productdevbook
Copy link
Author

productdevbook commented Jul 14, 2021

iam change scss to css and fixed my problem interested. scss very slow and dont hot reloading. via https://github.com/nuxt-community/tailwindcss-module

tailwindcss: {
    cssPath: '~/assets/styles/tailwind.css',
    viewer: false,
  },

CleanShot_2021-07-14_at_11 03 13

@bradlc
Copy link
Contributor

bradlc commented Jul 15, 2021

Hey @productfrontenddeveloper. We have looked into the hot reload problem and tracked it down to an issue when using PostCSS 8 with Nuxt. You can see details and a reproduction of the issue here: nuxt/postcss8#18 – this issue is not Tailwind-specific and happens with any CSS file.

Unfortunately we won't be able to fix this within the tailwindcss package, but there is a workaround if hot reloading is important to you:

  1. Don't use @nuxtjs/tailwindcss. Instead setup the Tailwind PostCSS 7 compatibility build manually and add it to your postcss config
  2. Set the TAILWIND_MODE environment variable to watch in your dev script. This is required because Nuxt uses an old version of postcss-loader. You can read more about this here: https://tailwindcss.com/docs/just-in-time-mode#styles-don-t-update-when-saving-content-files

Here's a basic setup for reference: https://github.com/bradlc/jit-nuxt

Going to close this because it isn't an issue with Tailwind, but hopefully the above is helpful!

@bradlc bradlc closed this as completed Jul 15, 2021
@productdevbook
Copy link
Author

Hey @productfrontenddeveloper. We have looked into the hot reload problem and tracked it down to an issue when using PostCSS 8 with Nuxt. You can see details and a reproduction of the issue here: nuxt/postcss8#18 – this issue is not Tailwind-specific and happens with any CSS file.

Unfortunately we won't be able to fix this within the tailwindcss package, but there is a workaround if hot reloading is important to you:

  1. Don't use @nuxtjs/tailwindcss. Instead setup the Tailwind PostCSS 7 compatibility build manually and add it to your postcss config

  2. Set the TAILWIND_MODE environment variable to watch in your dev script. This is required because Nuxt uses an old version of postcss-loader. You can read more about this here: https://tailwindcss.com/docs/just-in-time-mode#styles-don-t-update-when-saving-content-files

Here's a basic setup for reference: https://github.com/bradlc/jit-nuxt

Going to close this because it isn't an issue with Tailwind, but hopefully the above is helpful!

cc: @atinux

@medairbit
Copy link

Workaround to keep using @nuxtjs/tailwindcss without issue (nuxt-modules/tailwindcss#357 (comment))

@mod7ex
Copy link

mod7ex commented Oct 12, 2022

there is a way but i don't know how to do it , we can register a listner on the reload (save) and we save the index.scss or any scss file this will force the browser to show changes

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants