Skip to content

Commit 5d6c7d2

Browse files
colebemisCole Bemis
authored andcommitted
build: Add script to build dist/icons directory
1 parent 998b2e9 commit 5d6c7d2

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ all: lint build
88
lint: dist/icons.json
99
./node_modules/.bin/eslint .
1010

11-
build: dist/feather.js dist/feather.min.js
11+
build: dist/feather.js dist/feather.min.js dist/icons
1212

1313
node_modules:
1414
npm install
@@ -24,3 +24,8 @@ dist/feather.js: dist/icons.json $(src_dir) $(src_files)
2424

2525
dist/feather.min.js: dist/icons.json $(src_dir) $(src_files)
2626
./node_modules/.bin/webpack --output-filename feather.min.js -p
27+
28+
dist/icons: dist/icons.json
29+
rm -rf dist/icons
30+
mkdir -p dist/icons
31+
./node_modules/.bin/babel-node bin/build-svgs.js

bin/build-svgs.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @file Builds `dist/icons` directory.
3+
*/
4+
5+
import fs from 'fs';
6+
import path from 'path';
7+
import { icons, toSvg } from '../src';
8+
9+
Object.keys(icons).forEach(icon => {
10+
const svg = toSvg(icon);
11+
12+
fs.writeFileSync(path.resolve(__dirname, `../dist/icons/${icon}.svg`), svg);
13+
});

0 commit comments

Comments
 (0)