generated from deco-sites/start
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Integrates TailwindCSS with Decofile (#230)
- Loading branch information
Showing
2 changed files
with
31 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import autoprefixer from "npm:[email protected]"; | ||
import cssnano from "npm:[email protected]"; | ||
import postcss from "npm:[email protected]"; | ||
import tailwindcss from "npm:tailwindcss@3.3.3"; | ||
import tailwindcss from "npm:tailwindcss@3.4.1"; | ||
import { cyan } from "std/fmt/colors.ts"; | ||
import { ensureFile } from "std/fs/mod.ts"; | ||
import { join, toFileUrl } from "std/path/mod.ts"; | ||
|
@@ -17,7 +17,9 @@ const DEFAULT_TAILWIND_CSS = ` | |
@tailwind utilities; | ||
`; | ||
|
||
export const bundle = async ({ to, from }: { to: string; from: string }) => { | ||
export const bundle = async ( | ||
{ to, from, release }: { to: string; from: string; release: string }, | ||
) => { | ||
const start = performance.now(); | ||
|
||
// Try to recover config from default file, a.k.a tailwind.config.ts | ||
|
@@ -27,6 +29,15 @@ export const bundle = async ({ to, from }: { to: string; from: string }) => { | |
.then((mod) => mod.default) | ||
.catch(() => DEFAULT_OPTIONS); | ||
|
||
if (Array.isArray(config.content)) { | ||
config.content.push({ | ||
raw: release, | ||
extension: "json", | ||
}); | ||
} else { | ||
console.warn("TailwindCSS generation from decofile disabled"); | ||
} | ||
|
||
const processor = postcss([ | ||
// deno-lint-ignore no-explicit-any | ||
(tailwindcss as any)(config), | ||
|
This file contains 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