Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

mujer

cancerberoSgx5MIT0.0.5TypeScript support: included

Practical SVG processing tools for optimize, transform, format conversion, with JavaScript API for Node.js and browser and Command Line Interface

svg, JavaScript, browser, Node.js, optimization, transformation, format, conversion, CLI

readme

Mujer

Contents

Summary

Practical tools for vector graphics:

  • High level - easy to use
  • APIs for Node.js and Browser
  • Command line tools
  • Optimization
  • Transformations
  • Format conversion
  • more to come...

Install

npm install mujer

Tools

optimizeSvg

Minimizes SVG code size using svgo and optionally simplifyPaths utility.

Command line

svg-optimize --input "some/**/*.svg" --output output/folder

API

import {optimizeSvg} from 'mujer'

// We must pass the SVG code as input, in this case we read a file in node
// In the browser we could obtain the SVG code with a request or from a DOM Element
var output = await optimizeSvg({
  input: readFileSync('foo/bar.svg').toString()
})

// In node we could write the output to a file:
writeFileSync('foo/bar_optimized.svg', output)

// in the browser I could render in the document:
document.getElementById('svg-container').innerHTML = output

Options

TODO

svg2pdf

Command line

svg2pdf --input "some/**/*.svg" --output output/folder

API

import {svg2pdf} from 'mujer'

const pdf = await svg2pdf({
  input: './test/assets/test2.svg', 
  width: 1000, 
  height: 1000
})

// in node.js I could save it to a file
writeFileSync('output.pdf', pdf)

// in the browser I could make the user to download
// TODO: example

simplifyPaths

Command line

svg-simplify-paths --input "some/**/*.svg" --output output/folder --tolerance 3

API

import {svg2pdf} from 'mujer'

var output = await simplifyPaths({
  input: 'test2.svg', 
  width: 1000, 
  height: 1000,
  tolerance: 5
})

// in node.js I could save it to a file
writeFileSync('test2_simplified.svg', output)

// in the browser I could render in the document:
document.getElementById('svg-container').innerHTML = output

Options

TODO

TODO / Status / Roadmap

  • <input disabled="" type="checkbox"> Command line