Skip to content

pting-me/fresh_postcss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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