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: extends support #499

Merged
merged 16 commits into from Jul 13, 2022
Merged

feat: extends support #499

merged 16 commits into from Jul 13, 2022

Conversation

Tahul
Copy link
Contributor

@Tahul Tahul commented Jul 12, 2022

This PR improves #496 to support @nuxt/content sources.
It adds that support by pushing .nuxt/cache/content/parsed/**/*.md as a Tailwind content source.
Using .nuxt/cache instead of targeting content/ directory has multiple benefits:

  • We can ensure the Tailwind HMR happens after the content files has been parsed by @nuxt/content
    • This might lower the chances of encountering V8 errors by stacking FS calls on same HMR updates...
  • It supports content coming from multiple sources as they are fetched locally, meaning you can also use Tailwind classes > remote sources

This part has been moved into nuxt/content#1351

The PR also adds a return check on the tailwindcss:config hook, allowing to overwrite the whole Tailwind config from the hook by returning it.
Maybe we could close #498 in the same PR.

The PR now resolves #498 and #488 by providing support for extends layers in the configPath resolving.

It should also resolve #500, that has been introduced by 5.2.0.

configPath key now supports:

  • configPath: 'my-config/tailwind.config'
  • configPath: ['my-configs/tailwind.config', ...]

These ultimately gets resolved and merged layer-by-layer using defu.

This PR updates the structure of the module.ts file to allow such resolving, so should be reviewed with care.

I checked it myself and can't see any breaking changes, but I would appreciate anyone with some time to review it.

Maybe we could consider making an edge release for this branch @Atinux ?

src/module.ts Outdated Show resolved Hide resolved
src/module.ts Outdated Show resolved Hide resolved
@Tahul Tahul changed the title feat: @nuxt/content support feat: extends support Jul 12, 2022
src/module.ts Outdated Show resolved Hide resolved
@Atinux
Copy link
Collaborator

Atinux commented Jul 12, 2022

Agree for an edge release to beta test this!

@pi0
Copy link
Contributor

pi0 commented Jul 12, 2022

I do not think extending external tailwind config files is the best option. Having the file alone is an anti-pattern for Nuxt projects but with multi-layers, it is probably even not safe as tailwind itself does not do that. (you can still go with it. just sharing my feedback)

Extending support is also a good idea but please note that the current implementation is using undocumented _layers API and it might receive changes. I will try to communicate about this if it happens.

src/module.ts Outdated Show resolved Hide resolved
Tahul and others added 3 commits July 12, 2022 19:54
Co-authored-by: pooya parsa <pyapar@gmail.com>
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
@Tahul
Copy link
Contributor Author

Tahul commented Jul 13, 2022

@Atinux ; published @nuxtjs/tailwindcss-edge@5.2.0-b745f74

@Atinux
Copy link
Collaborator

Atinux commented Jul 13, 2022

I believe this one is still an improvement in term of DX for theme author since a tailwind.config is needed for Intelissense to work.

src/module.ts Outdated Show resolved Hide resolved
@Atinux Atinux merged commit f90b80b into nuxt-modules:main Jul 13, 2022
@bmulholland
Copy link

This did not resolve #500, which is still an open issue on 5.3.0

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.

Major 5.2.0 regression: no longer loads tailwind config by default Array syntax for configPaths
4 participants