How to use the webfont.default function in webfont

To help you get started, we’ve selected a few webfont 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 sedwards2009 / extraterm / extraterm / resources / extra_icons / build.js View on Github external
function main() {
  webfont({
    files: [
      'resources/extra_icons/1_maximize.svg',
      'resources/extra_icons/2_minimize.svg',
      'resources/extra_icons/3_osx_close.svg',
      'resources/extra_icons/4_osx_maximize.svg',
      'resources/extra_icons/5_osx_minimize.svg',
      'resources/extra_icons/6_triangle_down.svg',
      'resources/extra_icons/7_triangle_up.svg',
      'resources/extra_icons/8_rows.svg',
      'resources/extra_icons/9_pocketknife.svg',
    ],
    fontName: 'extraicons',
    formats: ['ttf']
  })
  .then((result) => {
      console.log("Done!");
github ballerina-platform / ballerina-lang / composer / packages / font / scripts / build-font.js View on Github external
const fontName = 'font-ballerina';
const webfontConfig = {
    files: path.resolve(__dirname, '../src/icons/**/*.svg'),
    fontHeight: 1000,
    normalize: true,
    fontName,
    templateClassName: 'fw',
    template: path.resolve(__dirname, '../src/template/template.css.njk'),
    glyphTransformFn: (obj) => {
        codepoints[obj.name] = obj.unicode;
        return obj;
    },
    hash: new Date().getTime(),
}

webfont(webfontConfig)
.then(result => {
    if(!fs.existsSync(path.join(buildDir, 'font'))) {
        fs.mkdirSync(path.join(buildDir, 'font'));
    }
    
    ['svg', 'ttf', 'eot', 'woff', 'woff2'].forEach(ext => {
        const fileName = `font-ballerina.${ext}`;
        const filePath = path.join(buildDir, 'font', fileName);
        fs.writeFile(filePath, result[ext], err => {
            if (err) {
                throw err;
            }
            console.log(`${fileName} written.`);
        });
    });
github summernote / summernote / config / build-fonts.js View on Github external
files: 'src/icons/*.svg',
  dest: 'src/styles/font/',
  formats: ['ttf', 'eot', 'woff', 'woff2'],
  fontName: 'summernote',
  template: 'src/icons/templates/summernote-icons.css',
  destTemplate: 'src/styles/summernote-icons.css',
  templateFontName: 'summernote',
  templateClassName: 'note-icon',
  templateFontPath: './font/',
  fixedWidth: false,
  normalize: true,
};

console.log('Building fonts...');

webfont(webfontConfig).then(result => {
  Object.keys(result).map(type => {
    if (
      type === 'config' ||
      type === 'usedBuildInTemplate' ||
      type === 'glyphsData'
    ) {
      return;
    }

    const content = result[type];
    let file = null;

    if (type !== 'template') {
      file = path.resolve(path.join(webfontConfig['dest'], webfontConfig['fontName'] + '.' + type));
    } else {
      file = path.resolve(webfontConfig['destTemplate']);
github akveo / eva-icons / scripts / services / build-web-font.js View on Github external
.then(() => {
      return webfont(webFontOptions)
        .then((result) => {
          const { fontName, template } = result.config;

          return Promise.all(
            Object.keys(result).map(type => {
              if (
                type === 'config' ||
                type === 'usedBuildInTemplate' ||
                type === 'glyphsData'
              ) {
                return Promise.resolve();
              }

              const content = result[type];
              let file = null;

webfont

Generator of fonts from svg icons, svg icons to svg font, svg font to ttf, ttf to eot, ttf to woff, ttf to woff2

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis