From 6b3abe34e2da2dcdd0fa277d2598f8274b6c6f5e Mon Sep 17 00:00:00 2001 From: Johan Fagerberg Date: Tue, 21 Aug 2018 12:43:18 +0200 Subject: [PATCH 1/8] Add Renren (#936) Color from their official .jpg logo from renren.com Note that the .jpg is very noisy - as such there are multiple shades of blue in it. The chosen one is from the biggest consistent area I could find. Alternative color choice: #005EAC from the .png logo from Wikipedia As no official SVG source is available, one was taken from third party sources. This was verified to match the official .jpg as closely as possible. --- _data/simple-icons.json | 5 +++++ icons/renren.svg | 1 + 2 files changed, 6 insertions(+) create mode 100644 icons/renren.svg diff --git a/_data/simple-icons.json b/_data/simple-icons.json index 7e621a99..3dc4d1a3 100644 --- a/_data/simple-icons.json +++ b/_data/simple-icons.json @@ -1480,6 +1480,11 @@ "hex": "764ABC", "source": "https://github.com/reactjs/redux/tree/master/logo" }, + { + "title": "Renren", + "hex": "217DC6", + "source": "https://seeklogo.com/vector-logo/184137/renren-inc" + }, { "title": "ReverbNation", "hex": "E43526", diff --git a/icons/renren.svg b/icons/renren.svg new file mode 100644 index 00000000..0f38a0ac --- /dev/null +++ b/icons/renren.svg @@ -0,0 +1 @@ +Renren icon \ No newline at end of file From 7fcb4d96a4e2f1a77063d60f488acd8f91fd7084 Mon Sep 17 00:00:00 2001 From: Johan Fagerberg Date: Tue, 21 Aug 2018 12:55:01 +0200 Subject: [PATCH 2/8] Add Envato icon (#935) Color taken from the official SVG on their website --- _data/simple-icons.json | 5 +++++ icons/envato.svg | 1 + 2 files changed, 6 insertions(+) create mode 100644 icons/envato.svg diff --git a/_data/simple-icons.json b/_data/simple-icons.json index 3dc4d1a3..d9ec9ce8 100644 --- a/_data/simple-icons.json +++ b/_data/simple-icons.json @@ -470,6 +470,11 @@ "hex": "72BE50", "source": "http://www.empire.kred" }, + { + "title": "Envato", + "hex": "81B441", + "source": "https://envato.com/" + }, { "title": "Ethereum", "hex": "3C3C3D", diff --git a/icons/envato.svg b/icons/envato.svg new file mode 100644 index 00000000..a0aef97e --- /dev/null +++ b/icons/envato.svg @@ -0,0 +1 @@ +Envato icon \ No newline at end of file From 55c3e181403e448bdde0ee402130037114fd3c9a Mon Sep 17 00:00:00 2001 From: Johan Fagerberg Date: Thu, 23 Aug 2018 12:58:45 +0200 Subject: [PATCH 3/8] Update Mastodon (#938) * Update Mastodon Taken straight from their official source Variant chosen is the one from their favicon Closes #750 * Update Mastodon color Source from their official SVG (thanks @ericcornelissen) --- _data/simple-icons.json | 4 ++-- icons/mastodon.svg | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_data/simple-icons.json b/_data/simple-icons.json index d9ec9ce8..42c27cfc 100644 --- a/_data/simple-icons.json +++ b/_data/simple-icons.json @@ -1042,8 +1042,8 @@ }, { "title": "Mastodon", - "hex": "189EFC", - "source": "https://github.com/tootsuite/mastodon/blob/master/app/assets/images/logo.svg" + "hex": "3088D4", + "source": "https://source.joinmastodon.org/mastodon/joinmastodon/blob/master/public/press-kit.zip" }, { "title": "Matternet", diff --git a/icons/mastodon.svg b/icons/mastodon.svg index 74740484..fe7e5074 100644 --- a/icons/mastodon.svg +++ b/icons/mastodon.svg @@ -1 +1 @@ -Mastodon icon \ No newline at end of file +Mastodon icon \ No newline at end of file From bc0fe39a0ede10042abd878e1395c09488fbb1f0 Mon Sep 17 00:00:00 2001 From: Johan Fagerberg Date: Sun, 26 Aug 2018 00:03:26 +0200 Subject: [PATCH 4/8] Add Castorama (#937) * Add Castorama * Update Castorama source --- _data/simple-icons.json | 5 +++++ icons/castorama.svg | 1 + 2 files changed, 6 insertions(+) create mode 100644 icons/castorama.svg diff --git a/_data/simple-icons.json b/_data/simple-icons.json index 42c27cfc..a0e0b307 100644 --- a/_data/simple-icons.json +++ b/_data/simple-icons.json @@ -260,6 +260,11 @@ "hex": "509CF6", "source": "https://www.campaignmonitor.com/brand" }, + { + "title": "Castorama", + "hex": "0078D7", + "source": "https://www.castorama.fr/" + }, { "title": "Castro", "hex": "00B265", diff --git a/icons/castorama.svg b/icons/castorama.svg new file mode 100644 index 00000000..420ca4bf --- /dev/null +++ b/icons/castorama.svg @@ -0,0 +1 @@ +Castorama icon \ No newline at end of file From d79e52436678413aad0ebdcf96d0f37f56ee18f9 Mon Sep 17 00:00:00 2001 From: Eric Cornelissen Date: Sun, 26 Aug 2018 12:11:48 +0300 Subject: [PATCH 5/8] Add Java (#945) * Add Java icon SVG As requested by @hlfernandez * Add Java icon details Used Java Blue (#007396) rather than Java Orange (#ED8B00) --- _data/simple-icons.json | 5 +++++ icons/java.svg | 1 + 2 files changed, 6 insertions(+) create mode 100644 icons/java.svg diff --git a/_data/simple-icons.json b/_data/simple-icons.json index a0e0b307..2d2be215 100644 --- a/_data/simple-icons.json +++ b/_data/simple-icons.json @@ -850,6 +850,11 @@ "hex": "FF3366", "source": "https://projects.invisionapp.com/boards/BX4P1DY5H46R" }, + { + "title": "Java", + "hex": "007396", + "source": "https://www.oracle.com/legal/logos.html" + }, { "title": "JavaScript", "hex": "F7DF1E", diff --git a/icons/java.svg b/icons/java.svg new file mode 100644 index 00000000..fc2530d1 --- /dev/null +++ b/icons/java.svg @@ -0,0 +1 @@ +Java icon \ No newline at end of file From 1aa1cf427c2d0a495bb18139e50f4bd5c3682a8e Mon Sep 17 00:00:00 2001 From: Eric Cornelissen Date: Mon, 27 Aug 2018 00:23:20 +0300 Subject: [PATCH 6/8] Add Go (the programmin language) (#944) Color based on their favicon gopher SVG manually vectorized based on their frontpage gopher --- _data/simple-icons.json | 5 +++++ icons/go.svg | 1 + 2 files changed, 6 insertions(+) create mode 100644 icons/go.svg diff --git a/_data/simple-icons.json b/_data/simple-icons.json index 2d2be215..571fc8d6 100644 --- a/_data/simple-icons.json +++ b/_data/simple-icons.json @@ -75,6 +75,11 @@ "hex": "FF5A5F", "source": "https://www.airbnb.com" }, + { + "title": "Go", + "hex": "76E1FE", + "source": "https://golang.org/doc/gopher/" + }, { "title": "Google Allo", "hex": "ECB842", diff --git a/icons/go.svg b/icons/go.svg new file mode 100644 index 00000000..8f66cb0b --- /dev/null +++ b/icons/go.svg @@ -0,0 +1 @@ +Go icon \ No newline at end of file From 6ee6ba977c7c7249e3aa2fb436d19681e058c986 Mon Sep 17 00:00:00 2001 From: Johan Fagerberg Date: Sun, 26 Aug 2018 23:23:57 +0200 Subject: [PATCH 7/8] Add prepublish script (#942) * Add prepublish script Compiles icons into both static js files (icons/{filename}.js) and into a static index.js. The latter is not tree-shakeable. Closes #941, closes #751 * Add information on tree-shaking to README * Remove index.js after publishing * Change 'prepublish' to 'prepublishOnly' * Link to webpack in README * Simplify postpublish cleanup Thanks @ericcornelissen * Fix quote usage in prepublish.js * Fix quote usage in utils.js * Optimized file size of prepublish output * Improved readability of prepublish script --- README.md | 17 +++++++++++++++++ index.js | 18 ------------------ package.json | 4 +++- scripts/prepublish.js | 31 +++++++++++++++++++++++++++++++ scripts/utils.js | 14 ++++++++++++++ 5 files changed, 65 insertions(+), 19 deletions(-) delete mode 100644 index.js create mode 100755 scripts/prepublish.js create mode 100644 scripts/utils.js diff --git a/README.md b/README.md index 6c0ee8c0..87f6be27 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,23 @@ console.log(simpleIcons['Google+']); */ ``` +Alternatively you can import the needed icons individually. +This is useful if you are e.g. compiling your code with [webpack](https://webpack.js.org/) and therefore have to be mindful of your package size: + +```js +const googleplus = require('simple-icons/icons/googleplus'); + +console.log(googleplus); +/* +{ + title: 'Google+', + hex: 'DC4E41', + source: 'https://developers.google.com/+/branding-guidelines', + svg: '...' +} +*/ +``` + ## Third Party Extensions ### WordPress diff --git a/index.js b/index.js deleted file mode 100644 index 9d40cefa..00000000 --- a/index.js +++ /dev/null @@ -1,18 +0,0 @@ -const dataFile = './_data/simple-icons.json'; -const data = require(dataFile); -const fs = require('fs'); - -const icons = {}; - -data.icons.forEach(i => { - const filename = i.title.toLowerCase() - .replace(/\+/g, "plus") - .replace(/^\./, "dot-") - .replace(/\.$/, "-dot") - .replace(/\./g, "-dot-") - .replace(/[ !’]/g, ''); - i.svg = fs.readFileSync(`${__dirname}/icons/${filename}.svg`, 'utf8'); - icons[i.title] = i -}); - -module.exports = icons; diff --git a/package.json b/package.json index a4e86bbe..bb9c86d1 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,8 @@ }, "scripts": { "jsonlint": "jsonlint _data/simple-icons.json -q -V .jsonlintschema", - "svglint": "svglint icons/* --ci" + "svglint": "svglint icons/* --ci", + "prepublishOnly": "node scripts/prepublish.js", + "postpublish": "rm icons/*.js index.js" } } diff --git a/scripts/prepublish.js b/scripts/prepublish.js new file mode 100755 index 00000000..00c0e998 --- /dev/null +++ b/scripts/prepublish.js @@ -0,0 +1,31 @@ +#!/usr/bin/env node +/** + * @fileoverview + * Compiles our icons into static .js files that can be imported in the browser + * and are tree-shakeable. + * The static .js files go in icons/{filename}.js. + * Also generates an index.js that exports all icons by title, but is not tree-shakeable + */ + +const dataFile = "../_data/simple-icons.json"; +const indexFile = `${__dirname}/../index.js`; +const iconsDir = `${__dirname}/../icons`; +const data = require(dataFile); +const fs = require("fs"); + +const { titleToFilename } = require("./utils"); + +const icons = {}; +data.icons.forEach(icon => { + const filename = titleToFilename(icon.title); + icon.svg = fs.readFileSync(`${iconsDir}/${filename}.svg`, "utf8"); + icons[icon.title] = icon; + // write the static .js file for the icon + fs.writeFileSync( + `${iconsDir}/${filename}.js`, + `module.exports=${JSON.stringify(icon)};` + ); +}); + +// write our generic index.js +fs.writeFileSync(indexFile, `module.exports=${JSON.stringify(icons)};`); diff --git a/scripts/utils.js b/scripts/utils.js new file mode 100644 index 00000000..9cd21c9e --- /dev/null +++ b/scripts/utils.js @@ -0,0 +1,14 @@ +module.exports = { + /** + * Converts a brand title into a filename (not a full path) + * @param {String} title The title to convert + */ + titleToFilename: title => ( + title.toLowerCase() + .replace(/\+/g, "plus") + .replace(/^\./, "dot-") + .replace(/\.$/, "-dot") + .replace(/\./g, "-dot-") + .replace(/[ !’]/g, "") + ) +} From 57e66ef99af40f21416a0df0bd534151cb8822eb Mon Sep 17 00:00:00 2001 From: Johan Fagerberg Date: Sun, 26 Aug 2018 23:24:45 +0200 Subject: [PATCH 8/8] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bb9c86d1..4cdec28f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-icons", - "version": "1.8.4", + "version": "1.8.5", "description": "SVG icons for popular brands https://simpleicons.org", "homepage": "https://www.simpleicons.org", "keywords": [