Skip to content
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

Merged
merged 2 commits into from
Jul 11, 2017
Merged

Create npm package #446

merged 2 commits into from
Jul 11, 2017

Conversation

peterpme
Copy link
Contributor

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 called simple-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!

@peterpme
Copy link
Contributor Author

@danleech just an FYI. No rush 馃槃

@birjj
Copy link
Contributor

birjj commented Jul 9, 2017

Could you please add a .npmignore file, keeping out everything but _data/, icons, package.json and README.md? If I understand NPM correctly, there's no point including all the webpage stuff in the package :P

@birjj birjj merged commit c266d1e into simple-icons:develop Jul 11, 2017
@birjj
Copy link
Contributor

birjj commented Jul 11, 2017

Merged this (and added .npmignore). Thanks for the work @peterpme! Going to let @danleech do the actual publishing.

@peterpme
Copy link
Contributor Author

Thanks :) We can move forward with #443 now :)

@jenil
Copy link
Contributor

jenil commented Sep 15, 2017

Hey any idea when @danleech will be publishing the npm package?

@peterpme
Copy link
Contributor Author

@jenil if you're interested you can start using this right away:
https://github.com/peterpme/create-simple-icon

@peterpme peterpme deleted the feature/npm branch September 15, 2017 15:56
@jenil
Copy link
Contributor

jenil commented Sep 15, 2017

@peterpme thanks for that, but that looks like a CLI app, does it have a node API?

@peterpme
Copy link
Contributor Author

No, but you can download any icon you need and then require the svg file!

How do you envision the node api to work?

@jenil
Copy link
Contributor

jenil commented Sep 15, 2017

give me something like this

@birjj
Copy link
Contributor

birjj commented Sep 15, 2017

Since @danleech seems pretty much dead, I'll probably end up doing the publishing instead. If anyone feels like adding the necesarry files (changing package.json -> main to point to a file which exports the content of the SVGs instead of their metadata) I can publish it asap.

@jenil
Copy link
Contributor

jenil commented Sep 15, 2017

@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. 馃檭

@birjj
Copy link
Contributor

birjj commented Sep 16, 2017

@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" ...'

jenil added a commit to jenil/simple-icons that referenced this pull request Sep 16, 2017
make is possible to import all icons with the SVG content, see example.js for usage
Discussion at simple-icons#446
@jenil jenil mentioned this pull request Sep 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants