Skip to content

Commit 1842263

Browse files
committed
configure build to preserve IDs on icon defs in SVG
1 parent 741b2ac commit 1842263

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

gulp.d/tasks/build.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ module.exports = (src, dest, preview) => () => {
113113
imagemin.jpegtran(),
114114
imagemin.optipng(),
115115
imagemin.svgo({
116-
plugins: [{ removeUselessDefs: false }, { removeViewBox: false }, { removeDesc: false }],
116+
plugins: [
117+
{ cleanupIDs: { preservePrefixes: ['icon-'] } },
118+
{ removeUselessDefs: false },
119+
{ removeViewBox: false },
120+
{ removeDesc: false },
121+
],
117122
}),
118123
].reduce((accum, it) => (it ? accum.concat(it) : accum), [])
119124
)

src/img/octicons.svg

Lines changed: 2 additions & 2 deletions
Loading

src/js/06-copy-to-clipboard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
svg.setAttribute('class', 'copy-icon')
2929
svg.setAttribute('viewBox', '0 0 16 16')
3030
var use = document.createElementNS('http://www.w3.org/2000/svg', 'use')
31-
use.setAttribute('href', window.uiRootPath + '/img/octicons.svg#clippy-16')
31+
use.setAttribute('href', window.uiRootPath + '/img/octicons.svg#icon-clippy-16')
3232
svg.appendChild(use)
3333
copy.appendChild(svg)
3434
;(toast = document.createElement('span')).className = 'copy-toast'

src/partials/header-content.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
--}}
8484
<a class="navbar-item" href="https://github.com/asciidoctor" target="_blank" rel="noopener">
8585
<span class="icon">
86-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><use href="{{{uiRootPath}}}/img/octicons.svg#mark-github"></use></svg>
86+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><use href="{{{uiRootPath}}}/img/octicons.svg#icon-mark-github"></use></svg>
8787
</span>
8888
</a>
8989
</div>

0 commit comments

Comments
 (0)