svg / svgo Goto Github PK
View Code? Open in Web Editor NEW⚙️ Node.js tool for optimizing SVG files
License: MIT License
⚙️ Node.js tool for optimizing SVG files
License: MIT License
There is another SVG-related library called «SVGo: A Go library for SVG generation». Apparently, it brings the name conflict and make it hard it find this tool, since that library goes to the first position in the search results. Id recommend to rename this tool to a some non-occupied name like «SVGopt».
http://www.w3.org/TR/SVG/paths.html#PathDataMovetoCommands
If a moveto is followed by multiple pairs of coordinates, the subsequent pairs are treated as implicit lineto commands.
<g transform="rotate(45)">
<path transform="scale(2)" d="..."/>
</g>
should become a
<path transform="rotate(45) scale(2)" d="..."/>
http://old.nabble.com/Negative-values-in-polygon-polyline-points-td27993375.html
so we can do
<path d="m10-20"/>
instead of
<path d="m10 -20"/>
but can't
<g transform="matrix(.707-.707 .707 .707 0 0)"/>
instead of
<g transform="matrix(.707 -.707 .707 .707 0 0)"/>
svgo -i test.svg -o test.min.svg
and
svgo test.svg test.min.svg
should be identical.
node.exand
, that has absolutely useless fs
dependency - not good for browserification. Better to replace with patched source.Finally, it would be nice to have:
This optimization is useful, if you like to generate SVG fonts without FontForge. Source image can have multiple paths + transformation rules. Result should be a single path. What needed:
Example:
Also, it would be nice to know how to calculate path bounding box (that's useful, if you like to crop or center image)
like in convertPathData plugin but at least for polyline and polygon data.
but if the default width/height are very small then increase the accuracy or do something else to reduce distortion.
JSON in config is brain killer. Please, consider use yaml. https://github.com/nodeca/js-yaml
We use this dependency, to avoid manual phantomjs installation install: https://github.com/Obvious/phantomjs
…because after absolute → relative path data transformation all browsers except Firefox have an internal rounding errors while calculating and rendering relative path :-/ and almost in all cases phantomjs test fails because WebKit has an almost invisible differences in a few pixels.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.