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

feat: upgrade to TailwindCSS 2 #203

Closed
wants to merge 2 commits into from
Closed

feat: upgrade to TailwindCSS 2 #203

wants to merge 2 commits into from

Conversation

Atinux
Copy link
Collaborator

@Atinux Atinux commented Nov 19, 2020

This PR is a breaking change since TailwindCSS 2 introduced breaking changes, see https://blog.tailwindcss.com/tailwindcss-v2 and https://tailwindcss.com/docs/upgrading-to-v2#upgrade-to-node-js-12-13-or-higher

Since it does not support Node < 12.13 we have to release this module as version 4 and forcing node >= 12.3.0.

Nuxt 2.14 is still running PostCSS 7 since we supports Node 8, we have a PR to drop support for it but will still support Node 10, see nuxt/nuxt#8346 and nuxt/nuxt#8408

When Nuxt 2.15 will be out, I will update to tailwindcss@latest directly and release the version 4 of this module.

In the meantime I updated the documentation to explain how to upgrade to tailwindcss@compat: https://tailwindcss.nuxtjs.org/setup#tailwind-2

Resolves #202

@codecov
Copy link

codecov bot commented Nov 19, 2020

Codecov Report

Merging #203 (e43bd35) into main (b57bbdc) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #203   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines           42        42           
  Branches         8         8           
=========================================
  Hits            42        42           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b57bbdc...e43bd35. Read the comment docs.

@Atinux Atinux marked this pull request as draft November 19, 2020 11:27
@germi
Copy link

germi commented Nov 21, 2020

Hi

unfortunatelly, installing the compat version with tailwindcss@compat throws errors (this, a few times)

Module build failed (from ./node_modules/postcss-loader/src/index.js): 
TypeError: value.charCodeAt is not a function

strangely enough I get this error on one machine and not on another. Node 14 installed in both.

I also attempted this with no luck: https://tailwindcss.com/docs/installation#post-css-7-compatibility-build

EDIT: this is related to the TailwindUI plugin apparently. when removing it, the problem is gone.

@vinayakkulkarni
Copy link

Hi

unfortunatelly, installing the compat version with tailwindcss@compat throws errors (this, a few times)

Module build failed (from ./node_modules/postcss-loader/src/index.js): 
TypeError: value.charCodeAt is not a function

strangely enough I get this error on one machine and not on another. Node 14 installed in both.

I also attempted this with no luck: tailwindcss.com/docs/installation#post-css-7-compatibility-build

EDIT: this is related to the TailwindUI plugin apparently. when removing it, the problem is gone.

const defaultTheme = require('tailwindcss/defaultTheme');

module.exports = {
  future: {
    removeDeprecatedGapUtilities: true,
    purgeLayersByDefault: true,
  },
  theme: {
    extend: {
      fontFamily: {
        sans: ['Inter var', ...defaultTheme.fontFamily.sans],
      },
    },
  },
  variants: {
    borderColor: ['responsive', 'hover', 'focus', 'active'],
    ...defaultTheme.variants,
  },
  plugins: [
    require('@tailwindcss/forms'),
    require('@tailwindcss/typography'),
    require('@tailwindcss/aspect-ratio'),
  ],
  purge: {
    // Learn more on https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css
    enabled: process.env.NODE_ENV === 'production',
    content: [
      'components/**/*.vue',
      'layouts/**/*.vue',
      'pages/**/*.vue',
      'plugins/**/*.js',
      'nuxt.config.js',
    ],
  },
};

I believe, you have to remove @tailwindcss/ui from plugins: [] - mentioned in the docs (https://tailwindui.com/changes-for-v2)

@Atinux
Copy link
Collaborator Author

Atinux commented Nov 25, 2020

Hi @vinayakkulkarni

Thank you, do you mind opening a PR to update the docs please? :)

@Heziode
Copy link

Heziode commented Dec 9, 2020

Any progress on this next major release ?

@UltraCakeBakery
Copy link

Any progress on this next major release ?

A pull request is ready to merge nuxt/nuxt#8591 which will include the changes required for this upgrade. I hope they will merge it somewhere between now and early next month.

Is this draft ready to be merged and published as soon as nuxt 2.15 gets published?

Copy link
Collaborator Author

Atinux commented Jan 14, 2021

I will have to do testing for this @UltraCakeBakery but it is the plan yes.

@hoektoe
Copy link

hoektoe commented Jan 31, 2021

When is this upgrade going to be merged or is there another way for me to upgrade to v2 on tailwindcss. Great work in the nuxt community.

@Heziode
Copy link

Heziode commented Jan 31, 2021

@hoektoe there is remaining work to be merged on other related project before it can be merged (take a look on related PR above).

You can already use Tailwind 2 in your project, take a look at: https://tailwindcss.nuxtjs.org/setup#tailwind-2

Nuxt 2.14 is still using PostCSS 7, we have a pull request opened to upgrade the dependencies. Once merged on v2.15, we will release a major version of this module to include TailwindCSS 2, see PR#203.

In the meantime, you can upgrade Tailwind by using the compatibility build:

yarn add --dev tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

Please ensure you are using Node >= 12.13.0 in order to use version 2 of TailwindCSS.

We have seen an issue with NPM regarding the packages resolution (see comment), we highly recommend using Yarn V1 when working with Nuxt 2.

@ThomOrlo
Copy link

When is this upgrade going to be merged or is there another way for me to upgrade to v2 on tailwindcss. Great work in the nuxt community.

Yes : https://tailwindcss.nuxtjs.org/setup#upgrading-tailwind

yarn add --dev tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

@hoektoe
Copy link

hoektoe commented Jan 31, 2021

@hoektoe there is remaining work to be merged on other related project before it can be merged (take a look on related PR above).

You can already use Tailwind 2 in your project, take a look at: https://tailwindcss.nuxtjs.org/setup#tailwind-2

Nuxt 2.14 is still using PostCSS 7, we have a pull request opened to upgrade the dependencies. Once merged on v2.15, we will release a major version of this module to include TailwindCSS 2, see PR#203.
In the meantime, you can upgrade Tailwind by using the compatibility build:

yarn add --dev tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

Please ensure you are using Node >= 12.13.0 in order to use version 2 of TailwindCSS.
We have seen an issue with NPM regarding the packages resolution (see comment), we highly recommend using Yarn V1 when working with Nuxt 2.

Awesome , sorry I misread the docs for that section.

@productdevbook
Copy link

coming soon ? :)

@viennv1709
Copy link

Nuxt v2.15 is out!

@@ -28,7 +28,7 @@
"consola": "^2.15.0",
"defu": "^3.2.2",
"fs-extra": "^9.0.1",
"tailwindcss": "^1.9.6"
"tailwindcss": "^2.0.1-compat"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the upgrade to nuxt 2.15, will we still need to depend on the compat version of tailwindcss?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we don't. Please upgrade tailwindcss to 2.0.3

Once the rest of your tools have added support for PostCSS 8, you can move off of the compatibility build by re-installing Tailwind and its peer-dependencies using the latest tag:

Copy link
Collaborator Author

Atinux commented Feb 16, 2021

Will work on it ASAP

@productdevbook
Copy link

productdevbook commented Feb 16, 2021

@Atinux
Do you intend to include this here? Or will we install external. Build times have a very fast effect.

https://windicss.netlify.app/guide/vue.html#nuxt
Github

@vinayakkulkarni
Copy link

WindiCSS could be an add-on and not a replacement for pure tailwindcss imho

Copy link
Collaborator Author

Atinux commented Feb 16, 2021

Indeed, it could be an option for the module (like windi: true). No idea I have to test it. Any feedback or sandboxes with it is more than welcome

@Zenthae
Copy link

Zenthae commented Feb 18, 2021

soon ?

Copy link
Collaborator Author

Atinux commented Feb 19, 2021

Looking at it next week, was recording my talk for Nuxt 3 and VueJS Amsterdam this week. Welcome to open source ☺️

@vinayakkulkarni
Copy link

Looking at it next week, was recording my talk for Nuxt 3 and VueJS Amsterdam this week. Welcome to open source ☺️

Super psyched about Nuxt 3!

Base automatically changed from master to main March 5, 2021 13:55
@pratik149
Copy link

Eagerly waiting!

@lpj145
Copy link

lpj145 commented Mar 8, 2021

nuxt/nuxt#8591 everything is fine, go ahead.

@luismarquesfreire
Copy link

Is it coming already? Need this urgently

@Heziode
Copy link

Heziode commented Mar 10, 2021

To all impatient :

Don't forget that we all have 24h in a day. No more.

So, just, be patient.

Note that you can already use Tailwind 2 in your project, take a look at: https://tailwindcss.nuxtjs.org/setup#tailwind-2

Nuxt 2.14 is still using PostCSS 7, we have a pull request opened to upgrade the dependencies. Once merged on v2.15, we will release a major version of this module to include TailwindCSS 2, see PR#203.

In the meantime, you can upgrade Tailwind by using the compatibility build:

yarn add --dev tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

Please ensure you are using Node >= 12.13.0 in order to use version 2 of TailwindCSS.

We have seen an issue with NPM regarding the packages resolution (see comment), we highly recommend using Yarn V1 when working with Nuxt 2.

@rxsto
Copy link

rxsto commented Mar 11, 2021

In addition to the comment above there is already a beta out for the upcoming major version 4.0.0 (@nuxtjs/tailwindcss@4.0.0-0). This will enable you to use tailwind v2 without the compatability dependencies. More information to be found here: #270 (I've tested it, it's running perfectly fine as of now, didn't encounter any issues yet).

@UltraCakeBakery
Copy link

To all impatient :

Don't forget that we all have 24h in a day. No more.

So, just, be patient.

Note that you can already use Tailwind 2 in your project, take a look at: https://tailwindcss.nuxtjs.org/setup#tailwind-2

I get where you come from and I agree with anyone that thinks we should never expect anything from open source project maintainers. But above the author says that the plan was to release this when nuxt 2.15 came out. It didn't, so he moved it to "next week", which was 3 weeks ago now.

People are not impatient, they are rightfully done waiting. Not all of us get away with dropping in a beta build or injecting dependencies manually. Some teams/companies have (high) standards.

@kissu
Copy link

kissu commented Mar 12, 2021

To all impatient :
Don't forget that we all have 24h in a day. No more.
So, just, be patient.
Note that you can already use Tailwind 2 in your project, take a look at: https://tailwindcss.nuxtjs.org/setup#tailwind-2

I get where you come from and I agree with anyone that thinks we should never expect anything from open source project maintainers. But above the author says that the plan was to release this when nuxt 2.15 came out. It didn't, so he moved it to "next week", which was 3 weeks ago now.

People are not impatient, they are rightfully done waiting. Not all of us get away with dropping in a beta build or injecting dependencies manually. Some teams/companies have (high) standards.

Hi, you can hit the "fork" button and submit a PR. That way, you will provide high standards to everybody here and get a lot of love coming from us. 🤗

@RomainLanz
Copy link
Contributor

Another PR that bump Tailwind to version 2 has been merged.

➡️ #270

@lpj145
Copy link

lpj145 commented Mar 12, 2021

To all impatient :
Don't forget that we all have 24h in a day. No more.
So, just, be patient.
Note that you can already use Tailwind 2 in your project, take a look at: https://tailwindcss.nuxtjs.org/setup#tailwind-2

I get where you come from and I agree with anyone that thinks we should never expect anything from open source project maintainers. But above the author says that the plan was to release this when nuxt 2.15 came out. It didn't, so he moved it to "next week", which was 3 weeks ago now.

People are not impatient, they are rightfully done waiting. Not all of us get away with dropping in a beta build or injecting dependencies manually. Some teams/companies have (high) standards.

Maybe i'm impatient, but not gracefully person, we need to understand open source projects always needs brave people, so i don't think what: people business/business company side is more important or great than people involved in projects, specially open source projects, "everbody need time" - is a good phrase.

Make love not war, thanks for great job. ❤

@Atinux
Copy link
Collaborator Author

Atinux commented Mar 15, 2021

Version 4 is out 🎊

https://github.com/nuxt-community/tailwindcss-module/releases/tag/v4.0.0

@Atinux Atinux closed this Mar 15, 2021
@pratik149
Copy link

Version 4 is out 🎊

https://github.com/nuxt-community/tailwindcss-module/releases/tag/v4.0.0

Thank you so much for all the efforts you guys put into improving Nuxt and its modules. ❤🤗

@hoektoe
Copy link

hoektoe commented Mar 16, 2021

Version 4 is out 🎊

https://github.com/nuxt-community/tailwindcss-module/releases/tag/v4.0.0

Awesome work guys, thank you so much for all the effort

@Atinux Atinux deleted the feat/tailwindcss2 branch March 8, 2022 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade tailwind 2.0.1