dll.js 571 B

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