@altano/html-cdnify
Version:
Transform the relative URLs in your HTML markup (e.g. scripts, stylesheets, images) to use your CDN URL.
26 lines (24 loc) • 984 B
TypeScript
import { HtmlAttributeStreamTransformer, TransformDefinition } from "./HtmlAttributeStreamTransformer.js";
//#region src/CDNTransformer.d.ts
type CDNTransformFunction = (cdnUrl: string, oldUrl: string, bufferPath: string) => string;
interface CDNTransformerOptions {
cdnUrl: string;
bufferPath?: string;
transformDefinitions?: TransformDefinition[];
transformFunction?: CDNTransformFunction;
}
/**
* Wraps a node-trumpet Transform stream, w/ HTML as input and
* HTML as output. The output will have all non-absolute-URL
* attributes that identify CDN-able resources converted to
* use the given CDN URL.
*/
declare class CDNTransformer extends HtmlAttributeStreamTransformer {
#private;
cdnOptions: Required<CDNTransformerOptions>;
constructor(cdnOptions: CDNTransformerOptions);
static defaultTransformFunction: CDNTransformFunction;
}
//#endregion
export { CDNTransformFunction, CDNTransformer, CDNTransformerOptions };
//# sourceMappingURL=CDNTransformer.d.ts.map