Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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!");
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.`);
});
});
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']);
.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;