Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
broccoli-rsvg
Advanced tools
This Broccoli plugin renders SVG files to PNG using node-rsvg.
First, get librsvg:
brew install librsvg
pkg install graphics/librsvg2
sudo apt-get install librsvg2-dev
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
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.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.svg',
width: 1200,
height: 1000
}
]
}
]
}
});
return [svg, png];
Note: do not pass broccoli-svgo output to rsvg, it might get screwed up.
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.
FAQs
SVG to PNG renderer for Broccoli
The npm package broccoli-rsvg receives a total of 20 weekly downloads. As such, broccoli-rsvg popularity was classified as not popular.
We found that broccoli-rsvg demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.