feat(includeFiles): support {from, to} object form for custom serve paths
includeFiles now accepts string | {from, to} entries. The object form
allows specifying a custom serve path (e.g. ./html/index.html -> index.html)
for base64ts bundled content.
This commit is contained in:
@@ -22,6 +22,20 @@ export class Base64TsOutput {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a file with a custom serve path
|
||||
*/
|
||||
public async addFileWithServePath(fromPath: string, servePath: string): Promise<void> {
|
||||
const absolutePath = plugins.smartpath.transform.toAbsolute(fromPath, this.cwd) as string;
|
||||
const fileExists = await plugins.fs.file(absolutePath).exists();
|
||||
if (!fileExists) {
|
||||
console.log(`File does not exist: ${absolutePath}`);
|
||||
return;
|
||||
}
|
||||
const content = await plugins.fs.file(absolutePath).read();
|
||||
this.addFile(servePath, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add files matching a glob pattern
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user