tiny-svg-1
TypeScript icon, indicating that this package has built-in type declarations

2.2.1 • Public • Published

tiny-svg

Build Status

tiny-svg is a minimal toolbelt for creating clean SVG applications.

Features

  • no wrapping magic, using native DOM elements instead
  • modular, just use what you need
  • 2kB minified + gzipped
  • innerSVG support
  • simplified attribute handling
  • geometry helpers

Checkout provided utilities.

Usage

import {
  appendTo,
  classes,
  create,
  innerSVG
} from 'tiny-svg';
 
var container = document.createElement('div');
var element = appendTo(create('svg'), container);
 
var g = appendTo(create('g'), element);
 
// add classes, SVG style!
classes(g).add('foo');
 
var text = `
  <g class="foo bar">
    <rect x="0" y="0" width="0" height="0" rx="50" ry="50"/>
  </g>
`;
 
// set innerSVG
innerSVG(g, text);

Your favourite module bundler should apply tree-shaking to only include the components your application requires. If you're using CommonJS modules give common-shake a try.

Related

  • min-dom - minimal DOM utility toolbelt
  • min-dash - minimal lodash inspired utility toolbelt

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i tiny-svg-1

Weekly Downloads

1

Version

2.2.1

License

MIT

Unpacked Size

67 kB

Total Files

9

Last publish

Collaborators

  • prateeknaik