Publish / publish (push) Successful in 3s
One self-contained stylesheet (.waves) with the wave PNG inlined and the gradient colours, angle and tile size as custom properties. Tags publish @mtps/waves to the Gitea npm registry. The README plans the move from the PNG to an SVG tile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
799 B
JavaScript
18 lines
799 B
JavaScript
// src/waves.css -> dist/waves.css with the texture inlined as a data URI,
|
|
// so consumers get one file and no asset paths for their bundler to resolve.
|
|
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
|
|
const src = new URL('../src/', import.meta.url);
|
|
const dist = new URL('../dist/', import.meta.url);
|
|
|
|
const css = readFileSync(new URL('waves.css', src), 'utf8').replace(
|
|
/url\('\.\/([^']+)\.png'\)/g,
|
|
(_, name) =>
|
|
`url('data:image/png;base64,${readFileSync(new URL(`${name}.png`, src)).toString('base64')}')`,
|
|
);
|
|
if (css.includes("url('./")) throw new Error('src/waves.css references a file that was not inlined');
|
|
|
|
mkdirSync(dist, { recursive: true });
|
|
writeFileSync(new URL('waves.css', dist), css);
|
|
console.log(`dist/waves.css: ${(css.length / 1024).toFixed(1)} KiB`);
|