tiny-svg

4.1.3last stable release 7 months ago
Complexity Score
Low
Open Issues
N/A
Dependent Projects
42
Weekly Downloadsglobal
82,296

License

  • MIT
    • Yesattribution
    • Permissivelinking
    • Permissivedistribution
    • Permissivemodification
    • Nopatent grant
    • Yesprivate use
    • Permissivesublicensing
    • Notrademark grant

Downloads

Readme

tiny-svg

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

Dependencies

Loading dependencies...

CVE IssuesActive
0
Scorecards Score
4.00
Test Coverage
No Data
Follows Semver
Yes
Github Stars
51
Dependenciestotal
14
DependenciesOutdated
5
DependenciesDeprecated
0
Threat Modelling
No Data
Repo Audits
No Data

Learn how to distribute tiny-svg in your own private NPM registry

npm config set registry  https://npm.cloudsmith.com/owner/repo
Processing...
Done
npm install tiny-svg
Processing...
Done

29 Releases

NPM on Cloudsmith

Getting started with NPM on Cloudsmith is fast and easy.