blog/lib/tasks/svg.ts

13 lines
424 B
TypeScript

import { Glob } from "glob";
import { from, mergeMap, tap } from "rxjs";
import { dest, loadFile } from "../rx-utils.js";
// SVG `use` has no way of allowing cross-origin, so we need to keep them with the HTML files.
export const svg = () =>
from(new Glob("src/*.svg", {}))
.pipe(
mergeMap(loadFile),
tap((f) => (f.path = f.path.substring(4))),
)
.forEach(dest("dist"));