https://github.com/cfware/icon-builder
Build `icons.js` in the target directory
https://github.com/cfware/icon-builder
Last synced: about 1 year ago
JSON representation
Build `icons.js` in the target directory
- Host: GitHub
- URL: https://github.com/cfware/icon-builder
- Owner: cfware
- License: mit
- Created: 2020-09-21T23:32:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-17T02:01:56.000Z (over 2 years ago)
- Last Synced: 2025-03-09T10:31:52.157Z (about 1 year ago)
- Language: JavaScript
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @cfware/icon-builder [![NPM Version][npm-image]][npm-url]
Build `icons.js` in the target directory.
## Usage
Create `./pkgs/icon/icon-chars.js`:
```js
export const iconChars = {
ban: '\uF05E',
'caret-down': '\uF0D7',
'caret-right': '\uF0DA',
download: '\uF019',
edit: '\uF044',
envelope: '\uF0E0',
'exclamation-triangle': '\uF071',
'id-card': '\uF2C2',
list: '\uF03A',
lock: '\uF023',
microphone: '\uF130',
'phone-alt': '\uF879',
plus: '\uF067',
'question-circle': '\uF059',
'sign-out-alt': '\uF2F5',
times: '\uF00D',
'trash-alt': '\uF2ED',
upload: '\uF093',
user: '\uF007'
};
```
The exported object should have keys associated with Font-Awesome icon names,
values should be the Unicode point to produce for the WOFF2 font.
```
npm i -D @cfware/icon-builder
npm i @cfware/shadow-element
npx cfware-iconbuilder ./pkgs/icon ./pkgs/icon/icon-chars.js iconChars
```
This command will produce `./pkgs/icon/icon.js`. Importing that file will
register the custom element `cfware-icon`. An example usage is:
```js
const banIcon = () => html``;
```
In addition `./pkgs/icon/fontawesome-free` will be created containing the
`package.json` and `LICENSE.txt` files installed by `@fortawesome/fontawesome-free`.
[npm-image]: https://img.shields.io/npm/v/@cfware/icon-builder.svg
[npm-url]: https://npmjs.org/package/@cfware/icon-builder