Replace image urls to data uri
npm install grunt-css-img-2-data-uriReplace image urls to data uri. Also warns if a data uri would be duplicated, so developer can move them under one CSS rule to save size.
~0.4.1If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
``shell`
npm install grunt-css-img-2-data-uri --save-dev
One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks('grunt-css-img-2-data-uri');
to the data object passed into grunt.initConfig().`js
grunt.initConfig({
throwOnDuplicate: true,
css_img_2_data_uri: {
options: {
files: [
{
src: 'path/to/source.css',
dest: 'path/to/output.css'
},
{
src: 'path/to/another/source.css',
dest: 'path/to/another/output.css'
}
]
}
}
})
`$3
#### options.files
Type:
ArrayList of css files which needs to be processed.
#### options.throwOnDuplicate
Type:
Boolean`If set to true, it throws an error when the same image found twice, so the grunt build would stop.