tholman / github-corners

A fresher "Fork me on GitHub" callout.
http://tholman.com/github-corners
MIT License
4.93k stars 193 forks source link

Create JS module & generate JSON file with variants. #23

Closed AndersDJohnson closed 8 years ago

AndersDJohnson commented 8 years ago

This PR makes this project a JavaScript module for npm (node & browser via UMD). It can generate the ribbon HTML with different options, e.g. custom colors, custom URL, custom wrap HTML, only SVG, etc. The PR also adds a JSON file (dist/github-corners.json), generated via the new JS code, that contains generated ribbon HTML for all of the example variants on the project page, and more.

So now we get the advantages of npm's ecosystem including update awareness via semantic versioning, etc.

My goal is to be able to pull this module from npm into my project, so I can simply inject the ribbon HTML into my templates without any copy/paste required (e.g. adding my own anchor link around the "blackNoWrap" version in the JSON).

After this, we could add more options, including more style variants, different minification levels, etc.

Eventually, it'd be nice to convert the index.html demo page into a generated template using the new code, as well as add an interactive live demo/builder feature with option tweaking.

tholman commented 8 years ago

Hey mate,

Wew, I really appreciate this... that said, I kind of feel like its adding a little more complexity, to something that is fairly simple. In the end, I wanted to imitate the ribbons github provided, as well as their implementation when people are using them.

Thanks though! (I feel really bad not merging this)