Socket
Book a DemoInstallSign in
Socket

svg-to-js

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-to-js

Module for concatenating SVG files into JavaScript

1.1.1
latest
Source
npmnpm
Version published
Weekly downloads
14
100%
Maintainers
1
Weekly downloads
 
Created
Source

svg-to-js

Module for concatenating SVG files into JavaScript.

Why load icons as JavaScript?

SVG symbols are great for styling and accessibility, but can not load cross domain, or from external file and in IE (9,10,11). Javascript provides us a cacheable, cross-domain method load the icons, without adding extra overhead to each html-file.

Usage

const svgtojs = require('svg-to-js');
const options = {
  svgFileName: 'core-icons.js',                 // Name of js-widh-svgs-file to create
  svgFileNameMin: 'core-icons.min.js',          // Name of minified js-widh-svgs-file
  srcPath: path.join(__dirname, '../src'),      // Folder of original svg files
  distPath: path.join(__dirname, '../dist'),    // Where to put js-widh-svgs-file
  banner: 'Copyright 2015-2017'                 // Text to add to top of file
}

svgtojs(options)
  .then(() => console.log('Merged and minified SVG')))
  .catch((err) => console.log(err.stack));

Keywords

SVG

FAQs

Package last updated on 31 Oct 2017

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.