Skip to content

MicleMing/svg-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svg parser

parse svg to vdom

import parser from 'svg-parser'

const setAttrsForText = (el) => {
  const tagName = el.tagName || ''
  if (tagName.toLowerCase() === 'text') {
    el.setAttribute('id', 'text')
  }
}
const rules = [setAttrsForText]
const vSvg = parser(svg, rules)

Releases

No releases published

Packages

No packages published