๐บ๏ธ Built-in PostCSS and Tailwind support #5083
Replies: 6 comments 5 replies
-
How will this affect how Tailwind works with Remix? |
Beta Was this translation helpful? Give feedback.
-
Will it be possible to use SCSS together? |
Beta Was this translation helpful? Give feedback.
-
Could you leave an example repository with this configuration? |
Beta Was this translation helpful? Give feedback.
-
How will this play with #3244 ? That is, assuming the other proposal lands, will it be possible/easy to use the out-of-the-box postcss implementation with a custom |
Beta Was this translation helpful? Give feedback.
-
Could one option be enabling Built-in Tailwind support when tailwindcss has been installed into the project? Then the user gets to control which version of Tailwind they are using, and then you don't need to introduce the overhead of PostCSS. Although supporting PostCSS and Tailwind as two separate things could also be an idea. |
Beta Was this translation helpful? Give feedback.
-
It is not working for tailwind in |
Beta Was this translation helpful? Give feedback.
-
Related issues
Motivation
The initial driver for this RFC was to explore built-in Tailwind support, but we realised that providing built-in PostCSS support will achieve this while also opening up a lot more use cases, e.g. postcss-preset-env, Autoprefixer.
Usage
First, you'll need to enable PostCSS. Similar to other recent CSS work, we can put it behind a feature flag:
With this flag enabled, we'll pick up the consumer's PostCSS config and use it whenever processing CSS in our compiler.
One potential edge case is that consumers may want to supply different plugins when using Vanilla Extract vs regular CSS source files since Vanilla Extract is already playing the role of preprocessor, so we might want to support the context object via postcss-load-config, e.g.
With this system in place, we could provide a default config with the Tailwind plugin already set up if we detect a Tailwind config/dependency but no PostCSS config.
Note that when using Tailwind via PostCSS, you need to insert the Tailwind directives somewhere in your CSS:
Besides cleaning up the setup needed to use Tailwind, this also unlocks the ability to use other Tailwind functions and directives anywhere in your CSS.
Open questions
Do we want to support Tailwind out of the box even when the PostCSS feature flag isn't enabled?
Beta Was this translation helpful? Give feedback.
All reactions