blog/lib/tasks/images.ts

14 lines
419 B
TypeScript

import { Glob } from "glob";
import hashPaths from "../hash.js";
import { dest, loadFile } from "../rx-utils.js";
import { from, mergeMap, tap } from "rxjs";
export const images = () =>
from(new Glob("src/*.avif", {}))
.pipe(
mergeMap(loadFile),
tap((f) => (f.path = f.path.substring(4))),
hashPaths("images.manifest"),
)
.forEach(dest("dist/_assets"));