Replies: 3 comments 8 replies
-
Using |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yep +1 to @tlgreg, it’s a PostCSS plug-in not really a tool by itself, so you can use it programmatically by using PostCSS programmatically 👍🏻 |
Beta Was this translation helpful? Give feedback.
5 replies
-
For anyone looking for code to do this, here's what worked for me: const tailwind = require("tailwindcss");
const postcss = require("postcss");
const html = '<div class="bg-red-300"></div>';
(async () => {
const result = await postcss([
tailwind({
//...config,
content: [{ raw: html, extension: "html" }],
}),
]).process(`@tailwind base;@tailwind components;@tailwind utilities;`, {
from: undefined,
});
console.log(result.css);
})(); |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Loving the framework, and the fact that you're opting to try Github Discussions!
I was wondering, are there any tailwind cli docs around to consume? I would love to get a grasp on how to invoke tailwind programmatically?
The use case I have is that I want to feed tailwind CSS via a buffer, or whatever which is stored in a database until it's used to generate a static page. Would prefer not to write to disk and invoking tailwind using a spawned process.
Beta Was this translation helpful? Give feedback.
All reactions