bem-icomoon
v0.0.1
Published
IcoMoon icons extracted as SVG in BEM notation
Downloads
2
Readme
bem-icomoon
IcoMoon icons extracted as SVG in BEM notation.
Be careful in the icomoon folder contains files from my old project and I do not remember under what license they are distributed !!!
Content
The library provides two modifiers for each icon:
bg
to use SVG as background imageglyph
to use inline SVG via templates (BEMHTML, BH, BHPHP)
icon/
_bg/
icon_bg_accessibility.css
icon_accessibility.svg
icon_bg_add.css
icon_bg_add.svg
# and so on
_glyph/
icon_glyph_accessibility.bemhtml.js
icon_glyph_accessibility.bh.js
icon_glyph_accessibility.bh.php
icon_glyph_add.bemhtml.js
icon_glyph_add.bh.js
icon_glyph_add.bh.php
# and so on
Installation
Add the library to project dependencies:
npm i bem-icomoon --save
Add it as redefinition level
If you don't use bem-components with
icon
block please addicon.css
with something like this:
.icon {
display: inline-block;
text-align: center;
background: 50% no-repeat;
}
/* Hack for correct baseline positioning */
.icon:empty:after {
visibility: hidden;
content: '\00A0';
}
.icon > img,
.icon > svg {
margin: -5.15em 0 -5em; /* 0.15 — magic number, empirically found */
vertical-align: middle;
}
You're done :)
Usage
BEMJSON
{ block: 'icon', mods: { bg: 'accessibility' } }
{ block: 'icon', mods: { glyph: 'accessibility' } }