JSPM

svg2js

0.0.4-alpha1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 456
  • Score
    100M100P100Q86232F
  • License MIT

Handy utility to convert SVG images to inline Javascript

Package Exports

  • svg2js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (svg2js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

svg2js

Handy utility to convert SVG images to inline Javascript

Installation

npm install --save svg2js

Usage

Svg2Js API is Promise based

Usage 1 (Save to file as Javascript Module):

import Svg2Js from 'svg2js'

Svg2Js.create({
  source: '/Users/userX/myImage.svg',
  destination: '/Users/userX/myImage.js'
}).then(() => console.log('SUCCESS!'))

after conversion JS SVG can be used as regular JS module

var MySvgImage = require('../../../../selectorAssets/runtime/icons/myImage.js')

//USE MySvgImage as inline value for rendering in various tools/libs

Usage 2 (Get inline value):

import Svg2Js from 'svg2js'

Svg2Js.convert({
  source: '/Users/userX/myImage.svg'
}).then((result) => console.log('SUCCESS!', result))

Contributing

Basicaly clone, change, test, push and pull request.

License

icon-toolkit is licensed under the MIT license.