Web Dev Solutions

Catalin Mititiuc

From e8fbe161e473a949f776f89d94e9816a64cd3114 Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Tue, 28 May 2024 14:45:20 -0700 Subject: Import mapsheets.svg --- src/import_mapsheets.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/import_mapsheets.js (limited to 'src/import_mapsheets.js') diff --git a/src/import_mapsheets.js b/src/import_mapsheets.js new file mode 100644 index 0000000..2e1b0fc --- /dev/null +++ b/src/import_mapsheets.js @@ -0,0 +1,8 @@ +import mapsheets from './assets/images/mapsheets.svg'; + +const useEls = document.querySelectorAll('svg use[data-href*="mapsheets.svg"'); + +useEls.forEach(el => { + const href = el.dataset.href.replace('mapsheets.svg', mapsheets.split('/').pop()); + el.setAttributeNS(null, 'href', href); +}); -- cgit v1.2.3