svg-reader
sync read svg icons and parse to icons object
get
npm install svg-reader
use
const read = var icons = /*icons = { home: { name: 'home', width: 928, height: 1000, path: 'M786 ... 12t-4-13z', ascent: 850, svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 928 1000"><g transform="scale(1,-1) translate(0 -850)"><path d="M78 ... 4-13z"/></g></svg>' }, link: { name: 'link', width: 928, height: 1000, path: 'M81 ... 14z', ascent: 850, svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 928 1000"><g transform="scale(1,-1) translate(0 -850)"><path d="M81 ... 114z"/></g></svg>' }, unlink: { name: 'unlink', width: 928, height: 1000, path: 'M24 ... 13z', ascent: 850, svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 928 1000"><g transform="scale(1,-1) translate(0 -850)"><path d="M24 ... 5-13z"/></g></svg>' }} */ //if do not need svg, pass a option { nosvg: true } var icons = /*icons = { home: { name: 'home', width: 928, height: 1000, path: 'M786 ... 12t-4-13z', ascent: 850}, link: { name: 'link', width: 928, height: 1000, path: 'M81 ... 14z', ascent: 850}, unlink: { name: 'unlink', width: 928, height: 1000, path: 'M24 ... 13z', ascent: 850}} */
test
git clone git@github.com:zxdong262/svg-reader.gitcd svg-readernpm inpm run test
License
MIT