Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const postcss = require("postcss");
const tailwind = require("tailwindcss");
const express = require("express");
const app = express();
app.get("/:configBase64/tailwind.css", async (req, res) => {
const buffer = Buffer.from(req.params.configBase64, "base64");
const config = JSON.parse(buffer.toString("utf-8"));
const baseCSS = `@tailwind base;@tailwind components;@tailwind utilities;`;
const { css } = await postcss([tailwind(config)]).process(baseCSS, {
from: undefined,
});
res.set("Content-Type", "text/css");
res.end(css);
});
app.listen(3000, () => console.log("Serving tailwindcss on port 3000!"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.