Files
unleash/src/lib/util/rewriteHTML.ts
T
Fredrik Strand Oseberg e22c7c8b37 Feat/serve frontend with baseuri (#824)
* chore: update changelog

* chore: update changelog

* feat: format asset paths and insert baseUri in html

* feat: add tests

* feat: pass dependencies to pre router hook

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-04-30 15:31:54 +02:00

8 lines
258 B
TypeScript

export const rewriteHTML = (input: string, rewriteValue: string): string => {
let result = input;
result = result.replace(/::baseUriPath::/gi, rewriteValue);
result = result.replace(/\/static/gi, `${rewriteValue}/static`);
return result;
};