mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-15 23:30:00 -04:00
fix: oh my god im dumb
This commit is contained in:
parent
635494f44f
commit
76cd888add
1 changed files with 3 additions and 2 deletions
|
@ -1,11 +1,11 @@
|
||||||
import { URLMeta, rewriteUrl, unrewriteUrl } from "./url";
|
import { URLMeta, rewriteUrl, unrewriteUrl } from "./url";
|
||||||
|
|
||||||
export function rewriteCss(css: string, meta: URLMeta) {
|
export function rewriteCss(css: string, meta: URLMeta) {
|
||||||
return handleCss("unrewrite", css, meta);
|
return handleCss("rewrite", css, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unrewriteCss(css: string) {
|
export function unrewriteCss(css: string) {
|
||||||
return handleCss("rewrite", css);
|
return handleCss("unrewrite", css);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCss(type: "rewrite" | "unrewrite", css: string, meta?: URLMeta) {
|
function handleCss(type: "rewrite" | "unrewrite", css: string, meta?: URLMeta) {
|
||||||
|
@ -17,6 +17,7 @@ function handleCss(type: "rewrite" | "unrewrite", css: string, meta?: URLMeta) {
|
||||||
css = css.replace(urlRegex, (match, url) => {
|
css = css.replace(urlRegex, (match, url) => {
|
||||||
const encodedUrl =
|
const encodedUrl =
|
||||||
type === "rewrite" ? rewriteUrl(url, meta) : unrewriteUrl(url);
|
type === "rewrite" ? rewriteUrl(url, meta) : unrewriteUrl(url);
|
||||||
|
console.log(encodedUrl);
|
||||||
|
|
||||||
return match.replace(url, encodedUrl);
|
return match.replace(url, encodedUrl);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue