Created
October 27, 2016 08:56
Star
You must be signed in to star a gist
Resize SVG path to 512px height (e.g. for better usage with grunt-webfont)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env node | |
// Usage: node resize-svg-path <currentHeight> <currentPath> | |
// E.g.: node resize-svg-path 32 "m0,16c0,-8.83656 7.16345,-16 16,-16c8.83655,0 16,7.16344 16,16c0,8.83656 -7.16345,16 -16,16c-8.83655,0 -16,-7.16344 -16,-16zm30,0c0,-7.73198 -6.26801,-14 -14,-14c-7.73199,0 -14,6.26802 -14,14c0,7.73198 6.26801,14 14,14c7.73199,0 14,-6.26802 14,-14zm-14,-1.41422l-3.53552,-3.53554l-1.41425,1.41422l3.53558,3.53554l-3.53558,3.53554l1.41425,1.41422l3.53552,-3.53554l3.53552,3.53554l1.41425,-1.41422l-3.53558,-3.53554l3.53558,-3.53554l-1.41425,-1.41422l-3.53552,3.53554z" | |
(function () { | |
'use strict'; | |
// Read command line arguments | |
var args = process.argv.slice(2); | |
var parse = require('parse-svg-path'); | |
var scale = require('scale-svg-path'); | |
var serialize = require('serialize-svg-path'); | |
var path = parse(args[1]); | |
console.log('\n\n' + serialize(scale(path, 512/args[0]))); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment