Socket
Socket
Sign inDemoInstall

tiny-svg

Package Overview
Dependencies
0
Maintainers
8
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tiny-svg

A minimal toolbelt for builing fast SVG-based applications


Version published
Weekly downloads
67K
decreased by-15.8%
Maintainers
8
Install size
57.8 kB
Created
Weekly downloads
 

Changelog

Source

4.0.0

  • CHORE: turn into ES module
  • CHORE: require Node >= 16
  • CHORE: drop UMD distribution

Breaking Change

  • This library is now an ES only module, and can consumed as such in modern JavaScript environments.

Readme

Source

tiny-svg

CI

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.

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

License

MIT

Keywords

FAQs

Last updated on 11 Mar 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc