Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const generateFont = (name = 'BpkIcon') =>
gulp
.src('src/icons/**/*.svg')
.pipe(chmod(0o644))
.pipe(
iconfont({
metadataProvider: getIconFontMetadataProvider(
'tasks/codepoints.json',
),
fontName: name,
formats: ['ttf', 'eot', 'woff'],
/**
* Normalize and fontHeight(>1000) are needed in order to have all the glyphs rendered
* correctly, for more info go to the npm package docs
* https://www.npmjs.com/package/gulp-iconfont
*/
normalize: true,
fontHeight: 1001,
timestamp: 1436442578, // A static timestamp to prevent changes showing up in git, backpack's first commit!
}),
);
gulp.task('build-iconfont', function(){
let runTimestamp = Math.round(Date.now()/1000);
return gulp.src([iconfont_dir + '/**/*.svg'])
.pipe(iconfont({
fontName: 'erudicon',
formats: ['ttf', 'eot', 'woff', 'svg'],
normalize: true,
fontHeight: 1001,
timestamp: runTimestamp
}))
.on('glyphs', function(glyphs, options) {
// CSS templating, e.g.
gulp.src(iconfont_dir + '/template.scss')
.pipe(consolidate('lodash', {
glyphs: glyphs,
fontName: 'erudicon',
fontPath: '/static/fonts/erudicon/',
className: 'erudicon'
}))
.pipe(rename('_erudicon.scss'))
gulp.task('iconfont', () => {
return gulp
.src('anubis/ui/misc/icons/*.svg')
.pipe(svgmin())
.pipe(gulp.dest('anubis/ui/misc/icons'))
.pipe(iconfont({
fontHeight: 1000,
prependUnicode: false,
descent: 6.25 / 100 * 1000,
fontName: 'anubisIcon',
formats: ['svg', 'ttf', 'eot', 'woff', 'woff2'],
timestamp: iconTimestamp,
normalize: true,
}))
.on('glyphs', (glyphs, options) => {
gulp
.src('anubis/ui/misc/icons/template/*.styl')
.pipe(nunjucks.compile({glyphs, options}))
.pipe(gulp.dest('anubis/ui/misc/.iconfont'))
})
.pipe(gulp.dest('anubis/ui/misc/.iconfont'));
});