New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

broccoli-rsvg

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-rsvg

SVG to PNG renderer for Broccoli

  • 0.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20
increased by1900%
Maintainers
1
Weekly downloads
 
Created
Source

broccoli-rsvg

This Broccoli plugin renders SVG files to PNG using node-rsvg.

Installation

First, get librsvg:

  • OS X: brew install librsvg
  • FreeBSD: pkg install graphics/librsvg2
  • Ubuntu/Debian: sudo apt-get install librsvg2-dev
  • Fedora/CentOS/OpenSUSE: sudo yum install librsvg2-devel

Second, install as any other broccoli plugin:

export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig # on OS X
npm install --save-dev broccoli-rsvg

Usage

var renderSvg = require('broccoli-rsvg');

var outputTree = renderSvg(inputTree, fileOptions);
  • inputTree: A tree that contains the SVG files you want to render.
  • fileOptions: A hash of rsvg options and alternative versions for each file; see the following example.

Example

var renderSvg = require('broccoli-rsvg');

var png = renderSvg("svg", {
  'logo.svg': {
    width: 600,
    height: 500, // optional override, values from the svg file itself are used by default
    versions: [
      { // Retina version example
        path: 'logo@2x.png',
        width: 1200,
        height: 1000
      },
      { // Transformed version example
        transformer: function(svg) {
          return svg.replace('#000000', '#ffffff'); // You can use elementtree or xmldom here...
        },
        path: 'logo-black.png',
        versions: [
          { // Nested example: transformed + retina
            path: 'logo-black@2x.png',
            width: 1200,
            height: 1000
          }
        ]
      }
    ]
  }
});

return [svg, png];

Note: do not pass broccoli-svgo output to rsvg, it might get screwed up.

License

Copyright 2014 Greg V <floatboth@me.com>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Keywords

FAQs

Package last updated on 31 May 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc