Skip to content

Commit

Permalink
copy all svgs to root
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudiohbsantos committed Dec 1, 2021
1 parent 67e45bb commit 07badab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions scripts/build-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ function src() {
const bundler = new Parcel(entryFile, parcelOptions);
const bundleMainScript = bundler.bundle();

const copyIcons = fs
.ensureDir(path.resolve(distPath, 'svg'))
.then(() => fs.copy(destSVGPath, path.resolve(distPath, 'svg')));
const copyIcons = fs.copy(destSVGPath, distPath);

const copyManifest = fs.copy(
path.resolve(srcPath, 'manifest.json'),
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function replaceIcon(itemRow, iconMap, languageMap) {
if (!iconName) return;

const newSVG = document.createElement('img');
newSVG.src = chrome.runtime.getURL(`svg/${iconName + '.svg'}`);
newSVG.src = chrome.runtime.getURL(`${iconName + '.svg'}`);
svgEl.getAttributeNames().forEach((att) => newSVG.setAttribute(att, svgEl.getAttribute(att)));

svgEl.parentNode.replaceChild(newSVG, svgEl);
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
}
],
"web_accessible_resources": [
"svg/*.svg"
"*.svg"
]
}

0 comments on commit 07badab

Please sign in to comment.