How to use the svg-sprite.renderConfig function in svg-sprite

To help you get started, we’ve selected a few svg-sprite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jkphl / node-iconizr / lib / iconizr.js View on Github external
setDataAndSingle				= function(currentData, data, type) {
		currentData.svg				= [];
		for (var s = 0; s < data.svg.length; ++s) {
			currentData.svg[s]		= _.extend({}, data.svg[s], data.svg[s][type]);
			delete currentData.svg[s].svg;
			delete currentData.svg[s].png;
		}
		return currentData;
	}
	
	// If the sprite at least one SVG image
	if (this.result.data.svg.length) {
		
		// Run through all configured rendering types
		for (var type in this._options.render) {
			var render							= SVGSprite.renderConfig(this._options.outputDir, this._options.render[type], type, __dirname);

			// If both a template and a destination file are given: Create tasks for it
			if (render.dest !== null) {

				if (this._options.verbose > 0) {
					console.log('Creating the "%s" output type ...', type);
				}
				
				// Non-stylesheet output types: Simple rendering
				if (['html', 'inline.svg'].indexOf(type) >= 0) {
					tasks[type]						= SVGSprite.renderTask(render.template, dest + '.' + type, _.extend({}, data), this.result);
					
				// Stylesheet output type: Render variants
				} else {
					++this.output;
					var data						= setDataAndSingle(_.extend({}, this.result.data), this.result.data, 'svg'),

svg-sprite

SVG sprites & stacks galore — A low-level Node.js module that takes a bunch of SVG files, optimizes them and bakes them into SVG sprites of several types along with suitable stylesheet resources (e.g. CSS, Sass, LESS, Stylus, etc.)

MIT
Latest version published 8 months ago

Package Health Score

66 / 100
Full package analysis