-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support publicURL #23
Comments
Hi, is this issue planned to be worked on? |
Yep, still needed and still planned. |
I could potentially help implement if you like. I am investigating this library at the moment. It looks like it could be the best fit so far since we use node steam rendering and I have not found any other library which delivers critical css for this use case. Right now, I am trying to get the streamed interleaving example working for my development environment but with no luck. Use of If I can get this working then I would be happy to help with this issue of supporting pubic Url since on our prod environment the assets are hosted on a different server. |
Take a look at this PR where all usages of styledStream.pipe(res, {
end: false
}); |
Ok, I think |
you need SSR in order to run into such issue during dev mode. const prefixURL = (prefix: string, url: string) => {
if (url.startsWith("http") || url.startsWith("data")) {
return url;
}
if (url.startsWith("/")) {
return `${prefix}${url}`;
}
return `${prefix}/${url}`;
};
const replacer = (prefix: string) => (match: string, host: string) => match.split(host).join(prefixURL(prefix, host));
export const prefixStyles = (styles: string, prefix: string) =>
styles.replace(/url\(([^)]*)/g, replacer(prefix)); |
@theKashey I talk about |
This issue is about postprocessing known styles to reflect their placement from the browser point of view. |
Sometimes CSS files are hosted on other domain, and resources used in CSS would refer to other domains.
useStyles
should supportpublicURL
as well as the ability to rewriteurl
in, for example, backgrounds.The text was updated successfully, but these errors were encountered: