Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nfroidure/svgfont2svgicons
Extract SVG icons from an SVG font
https://github.com/nfroidure/svgfont2svgicons
Last synced: about 1 month ago
JSON representation
Extract SVG icons from an SVG font
- Host: GitHub
- URL: https://github.com/nfroidure/svgfont2svgicons
- Owner: nfroidure
- License: mit
- Created: 2014-06-08T08:12:02.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2024-08-12T07:59:16.000Z (4 months ago)
- Last Synced: 2024-10-28T04:54:27.443Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 111 KB
- Stars: 15
- Watchers: 4
- Forks: 10
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-typography - svgfont2svgicons - Extract SVG icons from an SVG font. (JavaScript)
README
[//]: # ( )
[//]: # (This file is automatically generated by a `metapak`)
[//]: # (module. Do not change it except between the)
[//]: # (`content:start/end` flags, your changes would)
[//]: # (be overridden.)
[//]: # ( )
# svgfont2svgicons
> Extract SVG icons from an SVG font[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/svgfont2svgicons/blob/main/LICENSE)
[//]: # (::contents:start)
## Usage
### In your scripts
```js
import svgfont2svgicons from 'svgfont2svgicons';
import fs from 'node:fs';const fontStream = fs.createReadStream('myFont.svg');
const iconProvider = svgfont2svgicons(options);// Piping the font
fontStream.pipe(iconProvider);// Saving the SVG files
iconProvider.on('readable', function() {
let icon;do {
icon = iconProvider.read();
if(icon) {
console.log('New icon:', icon.metadata.name, icon.metadata.unicode);
icon.pipe(fs.createWriteStream(icon.metadata.name + '.svg'));
}
} while(null !== icon);
}).once('end', function() {
console.log('No more icons!')
});
```## CLI interface
```sh
svgfont2svgicons font/src/file.svg icons/dest/directory
```## Options
Currently no options, feel free to suggest some in
[the issues](https://github.com/nfroidure/svgfont2svgicons/issues).## Contributing
Feel free to pull your code if you agree with publishing under the MIT license.[//]: # (::contents:end)
# Authors
- [Nicolas Froidure](https://insertafter.com/en/index.html)# License
[MIT](https://github.com/nfroidure/svgfont2svgicons/blob/main/LICENSE)