From 5d6c7d2184d6a27e47606a36c144ca274fbbfd88 Mon Sep 17 00:00:00 2001
From: Cole Bemis <colebemis@gmail.com>
Date: Mon, 3 Jul 2017 15:24:07 -0700
Subject: [PATCH] build: Add script to build `dist/icons` directory

---
 Makefile          |  7 ++++++-
 bin/build-svgs.js | 13 +++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 bin/build-svgs.js

diff --git a/Makefile b/Makefile
index 33feb2a..4b4092b 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ all: lint build
 lint: dist/icons.json
 	./node_modules/.bin/eslint .
 
-build: dist/feather.js dist/feather.min.js
+build: dist/feather.js dist/feather.min.js dist/icons
 
 node_modules:
 	npm install
@@ -24,3 +24,8 @@ dist/feather.js: dist/icons.json $(src_dir) $(src_files)
 
 dist/feather.min.js: dist/icons.json $(src_dir) $(src_files)
 	./node_modules/.bin/webpack --output-filename feather.min.js -p
+
+dist/icons: dist/icons.json
+	rm -rf dist/icons
+	mkdir -p dist/icons
+	./node_modules/.bin/babel-node bin/build-svgs.js
diff --git a/bin/build-svgs.js b/bin/build-svgs.js
new file mode 100644
index 0000000..c69eb85
--- /dev/null
+++ b/bin/build-svgs.js
@@ -0,0 +1,13 @@
+/**
+ * @file Builds `dist/icons` directory.
+ */
+
+import fs from 'fs';
+import path from 'path';
+import { icons, toSvg } from '../src';
+
+Object.keys(icons).forEach(icon => {
+  const svg = toSvg(icon);
+
+  fs.writeFileSync(path.resolve(__dirname, `../dist/icons/${icon}.svg`), svg);
+});
-- 
2.21.0