0.2.21 • Published 4 years ago
iconic v0.2.21
iconic
Tools for SVG icons
Installation
npm install iconic
Using
CLI
iconic --output=bundle.js --element=ui-icon icons/*
Node
Compiling client script:
const iconic = require('iconic');
// Bundles all icons and renders script with webcomponent named 'ui-icon' definition
let bundle = iconic.bundle('ui-icon', {
icon1: svg,
icon2: svg,
icon3: svg,
});
Using icons:
<script src="/path/to/bundle.js"></script>
<h1>
<i><ui-icon name="icon1" /></i>
<span>Iconic</span>
</h1>
API
Iconic
const iconic = require('iconic');
// Bundles all icons and renders script with webcomponent named 'ui-icon' definition
let bundle = iconic.bundle('ui-icon', {
icon1: svg,
icon2: svg,
icon3: svg,
});
// Bundles all files in directory
let bundle = iconic.directoryBundle('ui-icon', dirname);
// Creating icon
let icon = iconic.createIcon(source, name);
Icon
const iconic = require('iconic');
let icon = iconic.createIcon(source, name);
// Is icon colored
icon.isColored();
// Get [width, height] size
icon.getSize();
icon
// Set monocolored icon color
.setColor('#ff0000')
// Resize icon
.resize(100, 100)
// Clear SVG code
.clear()
// Clear, optimize and set width and height to 100
.normalize()
// Write icon to file
.save('icon.svg');
// Export as PNG
icon.toPNG().then(data => fs.writeFileSync('icon.png', data));
// Export as JPEG
icon.toJPEG(backgroundColor).then(data => fs.writeFileSync('icon.jpeg', data));
Pack
const iconic = require('iconic');
let pack = new iconic.Pack();
// Add instance of Icon to pack
pack.addIcon(icon);
// Returns plain object with icon names as keys and svg code as values
pack.toJSON();
// Creates script with icons and webcomponent to display icons
pack.bundle((elementName = 'ui-icon'));
// Is pack contains colored icons
pack.isColored();
DevPlugins
ooi
;
0.2.21
4 years ago
0.2.20
4 years ago
0.2.17
4 years ago
0.2.16
4 years ago
0.2.15
4 years ago
0.2.14
4 years ago
0.2.12
4 years ago
0.2.11
4 years ago
0.2.10
4 years ago
0.2.7
4 years ago
0.2.9
4 years ago
0.2.8
4 years ago
0.2.6
4 years ago
0.1.16
7 years ago
0.1.15
7 years ago
0.1.14
7 years ago
0.1.13
7 years ago
0.1.11
7 years ago
0.1.10
7 years ago
0.1.4
8 years ago
0.1.2
8 years ago
0.1.0
8 years ago
0.0.9
8 years ago
0.0.8
8 years ago
0.0.7
8 years ago
0.0.6
8 years ago
0.0.2
8 years ago
0.0.1
9 years ago