blob: 7b8dd9bbef79872e85eb7f33976a47be726b9283 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/* eslint-disable import/prefer-default-export */
import axios from '~/lib/utils/axios_utils';
/**
* Retrieve SVG icon path content from gitlab/svg sprite icons
* @param {String} name
*/
export const getSvgIconPathContent = name =>
axios
.get(gon.sprite_icons)
.then(({ data: svgs }) =>
new DOMParser()
.parseFromString(svgs, 'text/xml')
.querySelector(`#${name} path`)
.getAttribute('d'),
)
.catch(() => null);
|