/fresh_postcss

PostCSS Plugin for Deno Fresh

Primary LanguageTypeScriptMIT LicenseMIT

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/**/*"],
    }),
  ],
});

Limitations

Cannot load PostCSS config files

Currently unable to use postcss-load-config. One of the (indirect) dependencies down the line fails due to an error on cspotcode/node-source-map-support.

Related: cspotcode/node-source-map-support#43