blog/lib/tasks/svg.ts

13 lines
424 B
TypeScript
Raw Normal View History

2024-06-27 01:28:17 +00:00
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.
2024-06-27 01:28:17 +00:00
export const svg = () =>
from(new Glob("src/*.svg", {}))
.pipe(
mergeMap(loadFile),
tap((f) => (f.path = f.path.substring(4))),
)
.forEach(dest("dist"));