src/index.js
function insertGlyphsRules(rule, result) {
    // Reverse order
    // make sure to insert the characters in ascending order
    let glyphs = result.glyphs.slice(0);
    let glyphLen = glyphs.length;
    while (glyphLen--) {
        let glyph = glyphs[glyphLen];
        let node = postcss.rule({
            selector: '.' + result.opts.fontName + '-' + glyph.name + ':before'
        });
        node.append(postcss.decl({
            prop: 'content',
            value: '\'\\' +
            glyph.unicode[0]
                .charCodeAt(0)
                .toString(16)
                .toUpperCase()
            + '\''
        }));

        rule.parent.insertAfter(rule, node);
    }

    let node = postcss.rule({
        selector: '[class^="' + result.opts.fontName + '-"], [class*=" ' + result.opts.fontName + '-"]'
    });
    [
        {prop: 'font-family', value: '\'' + result.opts.fontName + '\''},
        {prop: 'speak', value: 'none'},
        {prop: 'font-style', value: 'normal'},
        {prop: 'font-weight', value: 'normal'},
        {prop: 'font-variant', value: 'normal'},
        {prop: 'text-transform', value: 'none'},
        {prop: 'line-height', value: 1},
        {prop: '-webkit-font-smoothing', value: 'antialiased'},
        {prop: '-moz-osx-font-smoothing', value: 'grayscale'}
    ].forEach(function (item) {
        node.append(postcss.decl({
            prop: item.prop,
            value: item.value
        }));
    });

    rule.parent.insertAfter(rule, node);
}
function insertGlyphsRules(rule, result) {
    // Reverse order
    // make sure to insert the characters in ascending order
    let glyphs = result.glyphs.slice(0);
    let glyphLen = glyphs.length;
    while (glyphLen--) {
        let glyph = glyphs[glyphLen];
        let node = postcss.rule({
            selector: '.' + result.opts.fontName + '-' + glyph.name + ':before'
        });
        node.append(postcss.decl({
            prop: 'content',
            value: '\'\\' +
            glyph.unicode[0]
                .charCodeAt(0)
                .toString(16)
                .toUpperCase()
            + '\''
        }));

        rule.parent.insertAfter(rule, node);
    }

    let node = postcss.rule({
        selector: '[class^="' + result.opts.fontName + '-"], [class*=" ' + result.opts.fontName + '-"]'
    });
    [
        {prop: 'font-family', value: '\'' + result.opts.fontName + '\''},
        {prop: 'speak', value: 'none'},
        {prop: 'font-style', value: 'normal'},
        {prop: 'font-weight', value: 'normal'},
        {prop: 'font-variant', value: 'normal'},
        {prop: 'text-transform', value: 'none'},
        {prop: 'line-height', value: 1},
        {prop: '-webkit-font-smoothing', value: 'antialiased'},
        {prop: '-moz-osx-font-smoothing', value: 'grayscale'}
    ].forEach(function (item) {
        node.append(postcss.decl({
            prop: item.prop,
            value: item.value
        }));
    });

    rule.parent.insertAfter(rule, node);
}
function insertGlyphsRules ( rule , result ) { // Reverse order // make sure to insert the characters in ascending order let glyphs = result . glyphs . slice ( 0 ) ; let glyphLen = glyphs . length ; while ( glyphLen -- ) { let glyph = glyphs [ glyphLen ] ; let node = postcss . rule ( { selector : '.' + result . opts . fontName + '-' + glyph . name + ':before' } ) ; node . append ( postcss . decl ( { prop : 'content' , value : '\'\\' + glyph . unicode [ 0 ] . charCodeAt ( 0 ) . toString ( 16 ) . toUpperCase ( ) + '\'' } ) ) ; rule . parent . insertAfter ( rule , node ) ; } let node = postcss . rule ( { selector : '[class^="' + result . opts . fontName + '-"], [class*=" ' + result . opts . fontName + '-"]' } ) ; [ { prop : 'font-family' , value : '\'' + result . opts . fontName + '\'' } , { prop : 'speak' , value : 'none' } , { prop : 'font-style' , value : 'normal' } , { prop : 'font-weight' , value : 'normal' } , { prop : 'font-variant' , value : 'normal' } , { prop : 'text-transform' , value : 'none' } , { prop : 'line-height' , value : 1 } , { prop : '-webkit-font-smoothing' , value : 'antialiased' } , { prop : '-moz-osx-font-smoothing' , value : 'grayscale' } ] . forEach ( function ( item ) { node . append ( postcss . decl ( { prop : item . prop , value : item . value } ) ) ; } ) ; rule . parent . insertAfter ( rule , node ) ; }
Insert glyphs css rules
@param rule
@param result
Insert glyphs css rules