Skip to content

Instantly share code, notes, and snippets.

@carlosbensant
Created July 3, 2019 19:31
Show Gist options
  • Save carlosbensant/1aa1f4b82e77fba9bd215f9d4265c993 to your computer and use it in GitHub Desktop.
Save carlosbensant/1aa1f4b82e77fba9bd215f9d4265c993 to your computer and use it in GitHub Desktop.
Iconfont Generator
#! /usr/bin/env node
var path = require('path')
var glob = require('glob')
var webfontsGenerator = require('webfonts-generator')
const THEME_DIR = 'public/wp-content/themes/soventix';
glob(`${THEME_DIR}/assets/images/icons/*.svg`, {}, function (error, files) {
webfontsGenerator({
files: files,
dest: `${THEME_DIR}/assets/iconfonts/`,
cssDest: `${THEME_DIR}/assets/scss/vendors/_iconfont.scss`,
fontName: 'iconfont',
cssFontsUrl: 'assets/iconfonts',
html: false,
types: ['woff', 'eot'],
order: ['woff', 'eot'],
templateOptions: {
classPrefix: 's-icon--',
baseSelector: '.s-icon'
}
}, function(error) {
if (error)
console.log('Failed generating the font!', error)
else
console.log('Font generated succesfully!')
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment