Skip to content
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

Problem serving background-images from CDN in inline css #143

Closed
rd4704 opened this issue Jun 23, 2016 · 3 comments
Closed

Problem serving background-images from CDN in inline css #143

rd4704 opened this issue Jun 23, 2016 · 3 comments
Labels

Comments

@rd4704
Copy link

rd4704 commented Jun 23, 2016

Is there a way we can serve the background-images via a CDN. Currently the path in our styles are set to relative to the CDN which once comes to inline style doesn't work. If we can specify the full path to the images for the generated inline css would be great.
current : background:url(/img/banner/image.png)
expected which would work: background:url(https:/mycdn.com/img/banner/image.png)
Any suggestions please?

@addyosmani
Copy link
Owner

Thanks for filing a bug. Hmm. I'm trying to think about the best layer to tackle this at. We could potentially do it in https://github.com/bezoerb/inline-critical (cc @bezoerb) allowing you to readjust paths accordingly.

@bezoerb
Copy link
Collaborator

bezoerb commented Jul 11, 2016

@addyosmani, @rd4704 sorry for the late response. I think this issue could be resolved by #127

@bezoerb
Copy link
Collaborator

bezoerb commented Nov 30, 2018

We published a new prerelease version. You can now use the rebase option to specify/overwrite image paths. You even can define a transform function which will be called for every asset reference found in the stylesheet

You can install the new version with npm i critical@next

Thanks

Closing this for now but feel free to re-open if anything doesn't fit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants