summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rwxr-xr-xbuild/generate-svg.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/build/generate-svg.js b/build/generate-svg.js
index 31e65b8a75..dc82ed465a 100755
--- a/build/generate-svg.js
+++ b/build/generate-svg.js
@@ -25,14 +25,22 @@ async function processFile(file, {prefix, fullName} = {}) {
if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
}
+ // Set the `xmlns` attribute so that the files are displayable in standalone documents
+ // The svg backend module will strip the attribute during startup for inline display
const {data} = optimize(await readFile(file, 'utf8'), {
plugins: [
{name: 'preset-default'},
- {name: 'removeXMLNS'},
{name: 'removeDimensions'},
{name: 'prefixIds', params: {prefix: () => name}},
{name: 'addClassesToSVGElement', params: {classNames: ['svg', name]}},
- {name: 'addAttributesToSVGElement', params: {attributes: [{'width': '16'}, {'height': '16'}, {'aria-hidden': 'true'}]}},
+ {
+ name: 'addAttributesToSVGElement', params: {
+ attributes: [
+ {'xmlns': 'http://www.w3.org/2000/svg'},
+ {'width': '16'}, {'height': '16'}, {'aria-hidden': 'true'},
+ ]
+ }
+ },
],
});