import postcss, { Result } from "postcss"; import config from "../../postcss.config.ts"; import { dest, fromGlob } from "../rx-utils.ts"; import { lastValueFrom, mergeMap } from "rxjs"; import hashPaths from "../hash.ts"; import { VFile } from "vfile"; export const css = async () => { await lastValueFrom( fromGlob("src/index.css").pipe( mergeMap( (file) => new Promise((resolve) => postcss(config.plugins) .process(file.value, { from: file.path }) .then((result: Result) => { const encoder = new TextEncoder(); file.value = encoder.encode(result.css); file.path = "index.css"; resolve(file); }) ), ), hashPaths("css.manifest"), mergeMap(dest("dist/_assets")), ), ); };