Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 1x 1x 3x 3x 3x 3x 2x 2x 2x 2x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x | import { accessSync, readFileSync } from "node:fs"; import { join, resolve } from "node:path"; import * as core from "@actions/core"; import cssnano from "cssnano"; import postcss from "postcss"; import flexbugsFixes from "postcss-flexbugs-fixes"; import presetEnv from "postcss-preset-env"; import pcss from "../../assets/global.pcss"; import type { ActionInputs } from "../../utils/inputs"; export interface P { target: ActionInputs["target"]; theme: ActionInputs["theme"]; } export async function CSS({ target, theme }: P) { const css = await applyPostcssPlugins(pcss); const base = <style>{css}</style>; if (!theme) return base; const targetDir = resolve(target); const path = join(targetDir, theme); try { accessSync(path); } catch { core.warning(`- Theme file not found: ${path}`); return base; } const themePcss = readFileSync(path, "utf-8"); const themeCss = await applyPostcssPlugins(themePcss); core.debug(`- Using extended CSS: ${theme}`); return ( <> {base} <style>{themeCss}</style> </> ); } async function applyPostcssPlugins(css: string) { const result = await postcss([presetEnv(), flexbugsFixes(), cssnano()]).process(css, { from: undefined }); return result.css; } |