Skip to content

Instantly share code, notes, and snippets.

@thinkofher
Created August 18, 2024 12:56
Show Gist options
  • Save thinkofher/2f6e145f57c220ed6cef3e5aeac03a48 to your computer and use it in GitHub Desktop.
Save thinkofher/2f6e145f57c220ed6cef3e5aeac03a48 to your computer and use it in GitHub Desktop.
Tailwind in Deno
@tailwind base;
@tailwind components;
@tailwind utilities;
import { parse } from "https://deno.land/[email protected]/flags/mod.ts";
import { expandGlob } from "https://deno.land/[email protected]/fs/mod.ts";
import tailwind from "npm:[email protected]";
import postcss from "npm:[email protected]";
import autoprefixer from "npm:[email protected]";
import cssnanoPlugin from "npm:[email protected]";
import * as typography from "npm:@tailwindcss/[email protected]";
import {
dynamicIconsPlugin,
iconsPlugin,
} from "npm:@egoist/[email protected]";
import "npm:@iconify/[email protected]";
const cwd = new URL(".", import.meta.url);
const target = new URL("./out.css", cwd);
const stylesFile = new URL("./tailwind.css", cwd);
async function tailwindRun() {
const twConfig = {
content: ["./**/*.go"],
plugins: [
typography,
iconsPlugin(),
dynamicIconsPlugin(),
],
};
const styles = await Deno.readTextFile(stylesFile);
const result = await postcss([
tailwind(twConfig),
autoprefixer(),
cssnanoPlugin({ preset: "default" }),
]).process(styles, { from: undefined });
await Deno.writeTextFile(target, result.css);
}
await tailwindRun();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment