Skip to main content
Deno 2 is finally here 🎉️
Learn more

fresh_postcss

Fresh plugin for PostCSS integration

Usage

// main.ts
import autoprefixer from "https:/esm.sh/autoprefixer@10.4.14";

import { start } from "$fresh/server.ts";
import freshPostcss from "$fresh_postcss/mod.ts";

import manifest from "./fresh.gen.ts";

await start(manifest, {
  plugins: [
    freshPostcss({
      plugins: [
        autoprefixer(),
      ],
    }),
  ],
});

⚠️ DO NOT import CSS files directly in your code! ⚠️

The plugin will search your directory for CSS files, and the CSS will automatically be injected into <head>. You can also specify the files using glob syntax.

// main.ts
await start(manifest, {
  plugins: [
    freshPostcss({
      include: ["static/**/*.css"],
      exclude: ["static/_generated/**/*"],
    }),
  ],
});