package
Embed SVG files in CSS as data URIs with PNG fallback.
npm install svgcssGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Embed SVG files in CSS as data URIs with PNG fallback.
var svgcss = require('svgcss');
var options = {
source: 'images/*.svg',
destination: 'css/images.css'
};
var callback = function (err, result) {
// do something with result
};
svgcss(options, callback);optionsThe first argument to svgcss is an options object which can have any of the following properties:
source: glob that should match the svg files that should be used.destination: the file path where the CSS will be written.fallback: When true or a file path, converts _SVG_s to PNG and creates an additional CSS file with the PNG URIs embedded. Defaults to false.namespace: used to prefix CSS class names. Defaults to icon.data: if present, gets passed as data to the templating method together with each SVG file.process: override the function that generates the CSS code. An image object with name, namespace, width, height and uri is passed in.callbackThe callback receives an error object or null as the first argument. The second argument is an array of of objects, one for each SVG source file, with name, namespace, width, height, uri, css and optionally fallbackCSS properties.