mujer
Practical SVG processing tools for optimize, transform, format conversion, with JavaScript API for Node.js and browser and Command Line Interface
Last updated a year ago by cancerberosgx .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mujer 
SYNC missed versions from official npm registry.

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

  • [ ] Command line

Current Tags

  • 0.0.5                                ...           latest (a year ago)

4 Versions

  • 0.0.5                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.2                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (5)
Dev Dependencies (7)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |