Created
August 18, 2024 12:56
-
-
Save thinkofher/2f6e145f57c220ed6cef3e5aeac03a48 to your computer and use it in GitHub Desktop.
Tailwind in Deno
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tailwind base; | |
@tailwind components; | |
@tailwind utilities; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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