Skip to content

Commit 5b79982

Browse files
authoredJan 12, 2021
feat(icons): add icon assets as .svg files (#2657)
1 parent 6602fba commit 5b79982

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎packages/tools/lib/create-icons/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ registerIcon(name, { pathData, ltr, accData, collection });
3333
3434
export default { pathData, accData };`;
3535

36+
const svgTemplate = (pathData) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
37+
<path d="${pathData}"/>
38+
</svg>`;
3639

3740
const createIcons = (file) => {
3841
const json = JSON.parse(fs.readFileSync(file));
@@ -46,6 +49,7 @@ const createIcons = (file) => {
4649
const content = acc ? accTemplate(name, pathData, ltr, acc, json.collection) : template(name, pathData, ltr, json.collection);
4750

4851
fs.writeFileSync(path.join(destDir, `${name}.js`), content);
52+
fs.writeFileSync(path.join(destDir, `${name}.svg`), svgTemplate(pathData));
4953
}
5054
};
5155

0 commit comments

Comments
 (0)
Please sign in to comment.