main.js 544 B

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