https://github.com/wraith13/typed-octicons
Typed wrapper of GitHub Octicons for TypeScript.
https://github.com/wraith13/typed-octicons
npm npm-package octicons
Last synced: 3 months ago
JSON representation
Typed wrapper of GitHub Octicons for TypeScript.
- Host: GitHub
- URL: https://github.com/wraith13/typed-octicons
- Owner: wraith13
- Created: 2019-05-27T07:00:09.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-01-30T18:28:08.000Z (over 6 years ago)
- Last Synced: 2025-02-19T11:48:41.996Z (over 1 year ago)
- Topics: npm, npm-package, octicons
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/typed-octicons
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE_1_0.txt
Awesome Lists containing this project
README
# typed-octicons
`typed-octicons` is a typed wrapper of [GitHub Octicons](https://www.npmjs.com/package/@primer/octicons) for TypeScript.
## Install
```
$ npm install typed-octicons --save
```
## How to use
```typescript
import octicons from "typed-octicons";
const svg: string = octicons.bell.toSVG();
console.log(svg); //
const makeOcticonSVG = (octicon: Octicon | keyof typeof octicons): SVGElement =>
{
const div = document.createElement("div");
div.innerHTML =
(
"string" === typeof octicon ?
octicons[octicon]:
octicon
)
.toSVG();
return div.firstChild;
};
document.body.appendChild(makeOcticonSVG(octicons.bell));
document.body.appendChild(makeOcticonSVG("bell"));
```
## How to build
requires: [Node.js](https://nodejs.org/), [TypeScript Compiler](https://www.npmjs.com/package/typescript)
`tsc -P .` or `tsc -P . -w`
### In VS Code
You can use automatic build. Run `Tasks: Allow Automatic Tasks in Folder` command from command palette ( Mac: F1 or Shift+Command+P, Windows and Linux: F1 or Shift+Ctrl+P), and restart VS Code.
## License
[Boost Software License](./LICENSE_1_0.txt)