Is there a way to convert stylus URLs into base64 encoded form? I want to change url('/path/to/img.png')
to its base64 encoded version.
I have been referencing the documentation here, but it's not providing much help.
I attempted to include the necessary bits and example functions, importing url
, but I am unsure how to activate this feature.
Any suggestions on how to make this work?
UPDATE:
I am considering using the grunt-image-embed plugin.
Here is my Grunt configuration:
imageEmbed: {
dist: {
src: [ "./public/local/css/images.css" ],
dest: "./public/prod/css/images.css",
options: {
deleteAfterEncoding : false
}
}
},
The CSS file includes:
#footer-social .youtube {
width: 18px;
background-image: url('/img/youtube-icon.png');
}
This results in the error message:
Warning: File C:\path\...\grunt-image-embed\tasks\lib\img\youtube-icon.png
does not exist Use --force to continue.
If I remove the background-image
line, everything progresses smoothly. Unfortunately, I cannot alter the paths in the CSS as we rely on relative paths for images in the local
environment.