gulp-base64
gulp-base64 copied to clipboard
Directory condition to convert images
Is there any way to define a condition to only convert urls from a specific directory? Actually I'm using grunt-data-uri plugin from Grunt that allow to define this condition, but I'm starting to use Gulp tasks. The Grunt plugin is configured in this way:
grunt.config('dataUri', {
default: {
src: ['public/css/*.css'],
dest: 'public/css/',
options: {
target: ['public/images/inline-data/**']
}
}
});
The plugin converts only to base64 the images that are loaded from public/images/inline-data/*
.
If the image is loaded from a directory different from this, the plugin doesn't replace the url(image)
to base64.
You could use the exclude regex filter to do this probably, with a regex that matches anything NOT in that folder (e.g. negative lookahead).