Seamlessly include Tailwindcss
Is there a recommended way of achieving this at the moment?
What is the cleneast way of including tailwindcss with postcss in a Deno project while having autocomplete for the development?
4 Replies
Yes, the documentation recommends using Twind, a tailwind-in-js solution, for using Tailwind CSS in a Deno project. Twind is particularly useful in Deno’s server context, where Tailwind and CSS can be easily server-side rendered, generating dynamic, performant, and efficient CSS while having the usability of styling with Tailwind.
Here is a basic example of using Twind with Deno:
As for autocomplete, the documentation does not provide explicit information on how to achieve this with Twind in a Deno project. However, the Fresh framework, which is built for Deno, has a plugin system that supports Twind. This plugin automatically configures Twind for you to minimize boilerplate in your project. With this plugin, you can specify the class names directly in the JSX component, and the plugin will take care of the rest. This might provide a smoother development experience, but it's not explicitly stated in the
documentation that it provides autocomplete for Tailwind CSS classes.
The CLI would work:
If you need it more like a lib then something like this would work:
note that twind doesn't seem to be actively maintained anymore (i use it as well). unocss is roughly comparable although it doesn't have exactly full parity (but it has some features twind doesn't). integration with deno is fairly simple: https://github.com/gustwindjs/gustwind/blob/develop/plugins/uno/mod.ts
i know tailwind team is working on a rust based compiler so maybe we'll see native integration with deno one day. right now postcss dependency is blocking