withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
46.81k stars 2.49k forks source link

AstroJS collections are not accessible inside `tailwind.config` file #11831

Closed willpinha closed 2 months ago

willpinha commented 2 months ago

Astro Info

Astro                    v4.14.5
Node                     v21.7.1
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/react
                         @astrojs/tailwind

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I cannot use Astro collections inside the tailwind.config file, since the module "astro:content" is not defined

[postcss] Cannot find module 'astro:content'

What's the expected result?

Use a collection inside the tailwind.config file, since I have a collection with colors definitions and want to build custom Tailwind colors dynamically based on them

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-1yjmkk?file=tailwind.config.mjs

Participation

ematipico commented 2 months ago

Collections weren't designed to be imported in a tailwind configuration file.

Also, I don't think we have a documentation page where we show how you can do that.

Closing as it's not a bug

willpinha commented 2 months ago

Thanks for the answer! I'll think of an alternative solution. I will also pay attention to the right place to ask my questions.