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

data-uri doesn't work #38

Closed
mdreizin opened this issue Feb 27, 2015 · 7 comments
Closed

data-uri doesn't work #38

mdreizin opened this issue Feb 27, 2015 · 7 comments
Assignees

Comments

@mdreizin
Copy link

@jhnns, @sokra one again, it doesn't work, background-image: data-uri('../img/privateinvestocat.jpg');

lessc compiles correctly, but less-loader outputs corrupted image.

Here is data-uri.less:

.data-uri {
  background-image: data-uri('../img/privateinvestocat.jpg');
}

Where ../img/privateinvestocat.jpg is https://octodex.github.com/images/privateinvestocat.jpg

lessc --no-ie-compat test/less/data-uri.less test/less/data-uri.css outputs:

.data-uri {
  background-image: url("data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAABkAAD/4QMxaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZ...//Z");
}

but less-loader?ieCompat=false outputs:

.data-uri {
  background-image: url("data:image/jpeg;base64,77+977+977+977+9ABhFeGlmAABJSSoACAAAAAAAAAAAAAAA77+977+9ABFEdWNreQABAAQAAABkAADvv73vv70DMWh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8APD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMwMTQgNzkuMTU2Nzk3LCAyMDE0LzA4LzIwLTA5OjUzOjAyICAgICAgICvVJaSiPvv70L77+9dGjvv73vv73vv70k77+977+977+977+977+9biTvv73vv70S77+9RF0x77+9dO+/ve+/vdu7P++/vXLvv713Ee+/vSbvv73vv71/VWQbf2nvv70/Bxrvv73vv70ix4de77+9Je+/ve+/vTdz77+9aO+/ve+/vXHvv70uPR0TLe+/ve+/vULvv71Jbjbvv71NIceeW2zvv73jiZRy77+9c3Lvv73vv73vv70h77+977+9zY3vv73vv73vv70PU++/ve+/vWvvv73vv73vv71tCe+/ve+/vTNTRGbvv73elTrvv71w77+9Zu+/ve+/vQjvv71s77+977+977+9LUfvv73vv73vv71F77+9ce+/ve+/vWFnN17vv71d77+93rrvv71l77+9G++/vUU1H++/vXTvv73Gv++/ve+/vUFz77+9JQ3vv73vv70177+9RO+/ve+/ve+/ve+/vVHvv73vv73vv70477+977+977+9Uh7vv70cSe+/vV3vv71s77+9JXtNFjBbV++/ve+/vQXvv71e77+9J++/vQzvv73vv70gUzvvv70A77+9YnHvv73vv73vv70W77+9Rz7fk++/vW4r77+977+9Su+/vSrvv73vv70ReO+/ve+/ve+/ve+/ve+/AAAAPvv73vv70=");
}
@mdreizin mdreizin changed the title data-uri dosn data-uri doesn't work Feb 27, 2015
@sokra
Copy link
Member

sokra commented Feb 27, 2015

decoded

lessc: ff d8 ff e1 00 18 45 78 ...
less-loader: ef bf bd ef bf bd ef bf bd ef bf bd 00 18 45 78 ...

@mdreizin you can use url() and the url-loader instead of data-uri().

@mdreizin
Copy link
Author

@sokra Thanks for the response. I know about url-loader and I'm currently using this approach as workaround.

This is strange behaviour after migration from 0.7.7 to 2.0.0 :(

@jhnns
Copy link
Member

jhnns commented Mar 6, 2015

Agreed, the image should not be corrupted, I can take a look.

But to be honest, using the url() statement + url-loader seems more straightforward to me than using LESS' data-uri().

@mdreizin
Copy link
Author

The same for #43. It doesn't work and breaks LESS core functions.

@mdreizin
Copy link
Author

@jhnns Have you got any progress about this issue?

@jhnns
Copy link
Member

jhnns commented Apr 16, 2015

Sorry, I haven't got the time yet. There were some pretty weird things going on with the sass-loader ^^

next0 added a commit to next0/less-loader that referenced this issue Sep 28, 2015
```
Module build failed: error evaluating function `data-uri`: Cannot 'resolveSync' because the fileSystem is not sync. Use 'resolve'!
```
sokra added a commit that referenced this issue Nov 23, 2015
@jhnns
Copy link
Member

jhnns commented Nov 25, 2015

Fix shipped with 2.2.2

@jhnns jhnns closed this as completed Nov 25, 2015
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