Embed URL's as base64 strings inside your stylesheets
Embed URLs as base64 data URIs inside your stylesheets
There are lots of base64 embedding Grunt plugins out there, but pretty much all of them are already outdated and/or abandoned. This plugin aims to change that.
This plugin requires Grunt
~0.4.0 and Python
2.7, since it depends on node-gyp.
If 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:
npm install grunt-css-url-embed --save-dev
Task targets, files and options may be specified according to the grunt Configuring tasks guide.
Both image and font URLs are supported. Remote (
https) URLs are supported as well.
. or the directory of
The base directory for URLs. Can be absolute or relative to the directory of your
Will the script terminate if the file referenced by the URL is missing or the request to get it failed?
When set to
false a warning will be produced for each missing file or failed request.
Default: No restrictions
Skip URLs that are larger than the specified value.
Specifies the mode of embedding.
true(inclusive) means that you have to manually mark each URL that needs to be embedded using the
/* embed */comment.
false(exclusive) means that every URL is embedded, except those that are marked with
/* noembed */comment.
cssUrlEmbed:encodeWithBaseDir:options:baseDir: './app'files:'path/to/output.css': 'path/to/input.css'
cssUrlEmbed:encode:expand: truecwd: 'target/css'src: '**/*.css'dest: 'target/css'
cssUrlEmbed:encode:options:skipUrlsLargerThan: '5 MB'expand: truecwd: 'target/css'src: '**/*.css'dest: 'target/css'
inclusiveoption. See docs.
falseto disable this.