Skip to content

Commit

Permalink
feat(icons): add icon assets as .svg files (#2657)
Browse files Browse the repository at this point in the history
  • Loading branch information
pskelin committed Jan 12, 2021
1 parent 6602fba commit 5b79982
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/tools/lib/create-icons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ registerIcon(name, { pathData, ltr, accData, collection });
export default { pathData, accData };`;

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

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

fs.writeFileSync(path.join(destDir, `${name}.js`), content);
fs.writeFileSync(path.join(destDir, `${name}.svg`), svgTemplate(pathData));
}
};

Expand Down

0 comments on commit 5b79982

Please sign in to comment.