How to use the fontmin.css function in fontmin

To help you get started, we’ve selected a few fontmin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github junmer / icon-font / source.js View on Github external
}
};

if (src.length > 1 && !isFile(src[src.length - 1])) {
    dest = src[src.length - 1];
    src.pop();
}

// start fontmin
new Fontmin()
    .src(src)
    .use(Fontmin.svgs2ttf(fmOpts.fontFamily, fmOpts))
    .use(Fontmin.ttf2eot(fmOpts))
    .use(Fontmin.ttf2woff(fmOpts))
    .use(Fontmin.ttf2svg(fmOpts))
    .use(Fontmin.css(fmOpts))
    .use(dump(fmOpts))
    .dest(dest || 'output')
    .run((err, files, stream) => {

        if (err) {
            log(err);
            process.exit(1);
        }

        files.forEach(file => {
            log(`created: ${file.path}`);
        });

        log(`\nall ${files.length} files`);

    });
github junmer / serve-fontmin / index.js View on Github external
fmOpts.fontPath = ['.', opts.dest, ''].join('/');

        // font css font family
        fmOpts.fontFamily = font.name || font.basename;

        var stream = storage.src(font.srcPath)
            .pipe(Fontmin.glyph({
                text: font.text
            })())
            .pipe(streamRename({
                basename: font.hash
            }))
            .pipe(Fontmin.ttf2eot(fmOpts)())
            .pipe(Fontmin.ttf2woff(fmOpts)())
            .pipe(Fontmin.ttf2svg(fmOpts)())
            .pipe(Fontmin.css(fmOpts)())
            .pipe(storage.dest(opts.dest));

        stream.on('error', callback);
        stream.pipe(concat(callback.bind(null, null)));

    }
github rijn / nodecho / server / controllers / posts / -id / get.js View on Github external
.then(_s => {
            let deferred = Q.defer();
            if (_s.post.poem) {
                new Fontmin()
                    .src(fontPath)
                    .use(Fontmin.glyph({
                        text: _s.post.content
                    }))
                    .use(Fontmin.css({
                        fontFamily: 'poem-font',
                        base64: true
                    }))
                    .run((err, files) => {
                        if (err) {
                            console.error(err);
                        }
                        _s.post.font = files[1]._contents.toString();
                        deferred.resolve(_s);
                    });
            } else {
                deferred.resolve(_s);
            }
            return deferred.promise;
        })
github ecomfe / gulp-fontmin / index.js View on Github external
if (text && opts.chineseOnly) {
            text = text.replace(/[^\u4e00-\u9fa5]/g, '');
        }

        opts.text = text;

        var fontmin = new Fontmin()
            .src(file.contents)
            .use(rename({
                path: file.path
            }))
            .use(Fontmin.glyph(opts))
            .use(Fontmin.ttf2eot())
            .use(Fontmin.ttf2woff())
            .use(Fontmin.ttf2svg())
            .use(Fontmin.css(opts));

        if (opts.use) {
            opts.use.forEach(fontmin.use.bind(fontmin));
        }

        var fileStream = this;

        fontmin.run(function (err, files) {
            if (err) {
                cb(new gutil.PluginError('gulp-fontmin:', err, {fileName: file.path}));
                return;
            }

            var gulpFile;

            files.forEach(function (optimizedFile, index) {

fontmin

Minify font seamlessly, font subsetter, webfont (eot, woff, svg) converter.

MIT
Latest version published 1 month ago

Package Health Score

71 / 100
Full package analysis