Page MenuHomePhorge

postcss-assets.ts
No OneTemporary

Authored By
Unknown
Size
544 B
Referenced Files
None
Subscribers
None

postcss-assets.ts

import type { Plugin, PluginCreator } from "postcss";
import { asset } from "#/assets.ts";
const assetsPlugin: PluginCreator<void> = function (): Plugin {
return {
postcssPlugin: "assetsPlugin",
async Declaration(decl, _helper) {
const res = decl.value.match(/url\("([^"]+)"\)/);
if (!res || !res[1].startsWith("#")) {
return;
}
const assetPath = await asset(res[1]);
decl.value = decl.value.replace(res[1], assetPath);
},
};
};
assetsPlugin.postcss = true;
export default assetsPlugin;

File Metadata

Mime Type
application/javascript
Expires
Mon, Oct 26, 02:56 (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
109
Default Alt Text
postcss-assets.ts (544 B)

Event Timeline