-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create npm package #446
Create npm package #446
Conversation
@danleech just an FYI. No rush 馃槃 |
Could you please add a |
Thanks :) We can move forward with #443 now :) |
Hey any idea when @danleech will be publishing the npm package? |
@jenil if you're interested you can start using this right away: |
@peterpme thanks for that, but that looks like a CLI app, does it have a node API? |
No, but you can download any icon you need and then require the svg file! How do you envision the node api to work? |
give me something like this |
Since @danleech seems pretty much dead, I'll probably end up doing the publishing instead. If anyone feels like adding the necesarry files (changing |
@birjolaxew I can do that, make a library file which exports all the icon meta along with the SVG content, something like const SimpleIcons = require('simple-icons');
console.log(SimpleIcons);
/*
[{
title: '500px',
hex: '0099E5',
source: 'https://about.500px.com/press',
svg: '<svg aria-labelledby="simpleicons-500px-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill=""><title id="simpleicons-500px-icon">500px icon</title><path d="..."/></svg>'
},
{ ... }]
*/
console.log(SimpleIcons.toSvg('500px'));
// <svg aria-labelledby="simpleicons-500px-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill=""><title id="simpleicons-500px-icon">500px icon</title><path d="..."/></svg> Let me know if this works so I can proceed. 馃檭 |
@jenil I'd prefer exporting a simple map of icons, so that you can do: const SimpleIcons = require("simple-icons");
console.log(SimpleIcons);
/*
{
"500px": {
"hex": "0099E5",
"source": "https://about.500px.com/press",
"svg": 'svg aria-labelledby="simpleicons-500px-icon" role="img" ...'
},
...
}
*/
console.log(SimpleIcons["500px"].svg);
// 'svg aria-labelledby="simpleicons-500px-icon" role="img" ...' |
make is possible to import all icons with the SVG content, see example.js for usage Discussion at simple-icons#446
Hey @danleech!
Thanks again for creating this awesome resource!
Here's a basic package.json you can publish to npm. Once you merge this in and clone it, you can run
npm publish
and it'll automatically create an npm package calledsimple-icons
馃槃In this case, the only thing that will be consumed is
_data/simple-icons.json
but we can also build out all the icons or create another key that points to the official resource you're hosting so we're not bundling all the icons in the package.Some fun things you can do with npm too is create a build script that will automatically build all the icons for you and push them to the site so you don't have to.
Example:
Every time you merge in a new change, let travis or circle automatically take that icon and add it to the site.
Thanks again!