Socket
Socket
Sign inDemoInstall

broccoli-svg-sprite

Package Overview
Dependencies
359
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    broccoli-svg-sprite

A broccoli.js plugin for generating svg sprites using node.js svg-sprite module by Joschi Kuphal (https://github.com/jkphl/svg-sprite)


Version published
Weekly downloads
54
increased by3.85%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

broccoli-svg-sprite Build Status

The broccoli-svg-sprite plugin provides a wrapper around node.js svg-sprite module which takes a set of svg files, optimizes them and combines them into SVG sprites of several types

Installation

npm install --save-dev broccoli-svg-sprite

Usage

The broccoli-svg-sprite plugin is just a wrapper around the svg-sprite module. To use the plugin in your broccoli project, first import the plugin into your project:

var spriter = require('broccoli-svg-sprite');

Then, just instantiate a new spriter object passing in the appropriate options:

var svgSpriter = new spriter(srcFiles, spriteOptions);

where

srcFiles: is a data object containing:
	srcDir: the base directory containing your svg files.
	include: An array of inclusion glob patterns to filter files.
	exclude: An array of exclusion glob patterns to filter files.

spriteOptions: is a data object that will be passed as such to the svg-sprite module. For a detailed explanation of all available options, refer to https://github.com/jkphl/svg-sprite

Example:

var svgSpriter = new spriter(srcFiles, spriteOptions);
var srcFiles = {
  srcDir: 'svgs',
  include: ['**/*.svg'],
  exclude: []
};
var svgOptions = {
    dest: '.',

    shape: {
        spacing: { // Spacing related options
            padding: 1, // Padding around all shapes
            box: 'content' // Padding strategy (similar to CSS `box-sizing`)
        },
    },
    mode: {
        view: { // Activate the «view» mode
            dest: 'assets/images',
            bust: false,
            render: {
                css: {
                    dest: '../../app/styles/less/sprite.css'
                },



                scss: false,
                styl: false
            },
            prefix: 'svg-view-id',
            sprite: 'cw-svg-views-sprite.svg',
            example: false
        },
    }

};

var spriter = new svgSpriter(srcFiles, svgOptions);

module.exports = mergeTree([app.toTree(), spriter]);

Tests

npm install
mocha test

Acknowledgements

  • Joschi Kuphal (https://github.com/jkphl/svg-sprite)
  • Robert Jackson https://github.com/rwjblue
  • Jo Liss (https://github.com/joliss)

Keywords

FAQs

Last updated on 27 Oct 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc