main.js 472 B

1234567891011
  1. import symbolData from '../assets/twitter.svg';
  2. // => {id string, width: string, height: string, viewBox: string, url: string}
  3. console.log(symbolData);
  4. window.addEventListener('DOMContentLoaded', () => {
  5. const image = `<img width="${symbolData.width}" height="${symbolData.height}" src="${symbolData.url}">`;
  6. const usage = `<svg viewBox="${symbolData.viewBox}"><use xlink:href="${symbolData.url}"></use></svg>`;
  7. document.body.innerHTML = `${image} ${usage}`;
  8. });