nova-tailwind icon indicating copy to clipboard operation
nova-tailwind copied to clipboard

Nova 4 support?

Open scramatte opened this issue 2 years ago • 6 comments

Hi,

Can you add support for Nova 4 ? Thank you

Regards

scramatte avatar Apr 12 '22 00:04 scramatte

Just tried using some tailwindui styling on a Nova card and it looked horrid... also keen for a quick-fix of full Tailwind support on Nova 4 🥺

gbrits avatar May 24 '22 12:05 gbrits

Unfortunately, I don't think it's possible. The new Tailwind is way too big to be included like this. :( I looked into it and the CSS always came out at like 30mb or something.

I think we have to use the new JIT compiler for all the packages. :(

Tarpsvo avatar May 24 '22 13:05 Tarpsvo

😞

Could you elaborate on how to add full Tailwind / new JIT compiler on a single package @Tarpsvo?

gbrits avatar May 24 '22 13:05 gbrits

You can see an example in nova-color-field.

https://github.com/outl1ne/nova-color-field/blob/master/tailwind.config.js

https://github.com/outl1ne/nova-color-field/blob/master/resources/css/field.css

https://github.com/outl1ne/nova-color-field/blob/master/webpack.mix.js

Tarpsvo avatar May 26 '22 10:05 Tarpsvo

@Tarpsvo Thanks for this; I set up a full custom tailwind config in 2 minutes. Thanks to you!

timothepearce avatar Jul 11 '22 08:07 timothepearce

You can see an example in nova-color-field.

https://github.com/outl1ne/nova-color-field/blob/master/tailwind.config.js

https://github.com/outl1ne/nova-color-field/blob/master/resources/css/field.css

https://github.com/outl1ne/nova-color-field/blob/master/webpack.mix.js

There is a hacky way to set up tailwind css for all your nova components in one go. Create an asset, set up tailwind css. Follow the above example. All you have to do is set your path in content array in tailwind.config.js. Please keep in mind that above example is for field so you will have to replace field.extension with asset.extension for filenames.

  content: [
      "../../**/*.vue", // Target all the .vue files in your nova-components if this code is inside nova-components
      "../../**/*.css", // Target all ".css" file inside nova-components
      "../../**/*.scss", // Target all ".css" file inside nova-components
  ],

Your asset compiled assets will be included by nova automatically. Just make sure you recompile it when you add new classes to other nova components.

MacTavish-69 avatar Sep 15 '22 17:09 MacTavish-69