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

How to inline base64 images? #12

Open
eshion opened this issue Jan 14, 2016 · 5 comments
Open

How to inline base64 images? #12

eshion opened this issue Jan 14, 2016 · 5 comments

Comments

@eshion
Copy link

eshion commented Jan 14, 2016

How to inline base64 image string instead of image url path? can file-loader be replaced by url-loader?
https://github.com/webpack/url-loader

@deusdeorum0
Copy link

+1 i need that too

@skozin
Copy link
Owner

skozin commented Feb 2, 2016

@eshion, @deusdeorum0, you can try this construction in any file that is processed by webpack-path-rewriter:

[[ INLINE(asset-path) ]]

It will insert asset's content instead of the path. It's not in the docs yet, unfortunately. Here is the commit that implemented it: 02ffc32.

@skozin
Copy link
Owner

skozin commented Feb 2, 2016

However, it won't convert the content to base64, so the image already needs to be base64-encoded. But I can add base64 encoding support if you really need it. Something like this:

[[ INLINE_BASE64(asset-path) ]]

@eshion
Copy link
Author

eshion commented Feb 5, 2016

It complain:ERROR in assets/index.html: could not resolve path "INLINE(./images/hi.png)"

@skozin
Copy link
Owner

skozin commented Feb 6, 2016

@eshion, are you using the latest version from NPM (1.1.3)? I'll try to reproduce your setup as soon as I get some spare time.

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

No branches or pull requests

3 participants