goetzrobin / spartan

Cutting-edge tools powering Angular full-stack development.
https://spartan.ng
MIT License
1.22k stars 134 forks source link

Support Tailwind with Prefix #134

Closed Lowell20 closed 7 months ago

Lowell20 commented 7 months ago

Which scope/s are relevant/related to the feature request?

Don't know / other

Information

This would apply to all components. Using tailwind with prefix like: module.exports = { presets: [require('@spartan-ng/ui-core/hlm-tailwind-preset')], prefix: 'tw-', ...

Tried using in component but does not seem to work as expected: export const buttonVariants = cva( 'tw-rounded-md', ...

Describe any alternatives/workarounds you're currently using

No response

I would be willing to submit a PR to fix this issue

goetzrobin commented 7 months ago

Are you saying the CLI is not able to copy code with a prefix correctly or even with the prefix added to the classes in the hlm components the styles do not get applied correctly?

Lowell20 commented 7 months ago

I’ve added the prefix in the hlm component and those classes did not get applied

goetzrobin commented 7 months ago

@Lowell20 I think this might be a tailwind limitation: https://github.com/tailwindlabs/tailwindcss/discussions/6126 What you can do is copy the code from the spartan preset and just add it directly to your tailwind config: https://github.com/goetzrobin/spartan/blob/main/libs/ui/core/hlm-tailwind-preset.js

goetzrobin commented 7 months ago

@Lowell20 I closed this issue for now as wontfix, because of the upstream limitation. If you have a different idea of working around this, e.g. support a prefix creation function or something feel free to create a separate issue/open a PR!

Lowell20 commented 7 months ago

No worries, thanks for the update!