edp-build-url-embed
Embed URL's as base64 strings inside your stylesheets using edp build
Install
npm install edp-build-url-embed --save-dev
Usage
Add code in edp-build-config.js
var UrlEmbededProcessor = require('edp-build-url-embed');
var urlEmbed = new UrlEmbededProcessor();
Options
inclusive
Type: Boolean
Default: false
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.
extensions
Type: Array
Default: ['.jpg', '.png']
Specifies the extensions of urls to be embed.
files
Type: Array
Default: ['*.styl', '*.css', '*.less']
Input files.
Excluding URLs manually (when inclusive: false)
.exclude-me {
background-image: url('exclude_me.png');
}
Including URLs manually (when inclusive: true)
.include-me {
background-image: url('include_me.png');
}
When URLs are in the middle of CSS property
.include-me1 {
background: transparent url('include_me.png') center center no-repeat;
}
.include-me2 {
background-image: -webkit-image-set(url('include_me1.png') 1x, url('include_me2.png') 2x);
}