@rikishi/svg-scaler-viewbox
SVG scale utility
Last updated 9 months ago by rikishi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @rikishi/svg-scaler-viewbox 
SYNC missed versions from official npm registry.

SVG Scaler

Scale svg size

Install

yarn add style-loader --dev

or using npm

npm install style-loader --save-dev

Usage

import SVGTranslator from 'svg-scaler-viewbox';

new SVGTranslator({ width: 24 }).process(`
  <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48">
    <circle cx="24" cy="24" r="24" fill="#D8D8D8"/>
  </svg>
`).then((result) => {
  console.log(result)
});

Options

width

type:number, will make the svg scale to the size by the number, will fix to square, unity all svg files to same size.

scale

type:number, just normal scale, but if have the width or the height option, the scale will not work.

Warning

  • not support image in svg.

Thanks

Current Tags

  • 0.2.5                                ...           latest (9 months ago)

1 Versions

  • 0.2.5                                ...           9 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |