svg-scaler-viewbox

0.1.7 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i svg-scaler-viewbox

Weekly Downloads

19

Version

0.1.7

License

MIT

Unpacked Size

15.5 kB

Total Files

9

Last publish

Collaborators

  • madzhup