Skip to content

Instantly share code, notes, and snippets.

@anderson-mota
Last active July 10, 2018 16:52
Show Gist options
  • Save anderson-mota/1350e278d607737d25525d5aadf3712d to your computer and use it in GitHub Desktop.
Save anderson-mota/1350e278d607737d25525d5aadf3712d to your computer and use it in GitHub Desktop.
Generate icons.
/**
<%= fontName %> Webfont
*/
@font-face {
font-family: '<%= fontName %>';
src: url('../fonts/<%= fontName %>.eot?<%= fontDate %>');
src: url('../fonts/<%= fontName %>.eot?#iefix-<%= fontDate %>') format('embedded-opentype'),
url('../fonts/<%= fontName %>.woff2?<%= fontDate %>') format('woff2'),
url('../fonts/<%= fontName %>.woff?<%= fontDate %>') format('woff'),
url('../fonts/<%= fontName %>.ttf?<%= fontDate %>') format('truetype');
font-weight: normal;
font-style: normal;
}
[class^="lm-ico-"],
[class*=" lm-ico-"] {
font-family: '<%= fontName %>' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/*
Glyphs list
*/
<% _.each(glyphs, function(icon){ %>
.lm-ico-<%= icon.name.replace(/\s+/g,'-').replace(/[(!@#$)]/g, '') %>:before {
content: '\<%= icon.unicode[0].charCodeAt(0).toString(16) %>';
}
<% }) %>
/**
* Generate icons automaticaly
*/
gulp.task('generate-icons', function () {
gulp.src('./skins/webmail2016/assets/icons/*.svg')
.pipe(iconfont({
fontName: 'icomoon',
formats: ['ttf', 'eot', 'woff', 'woff2', 'svg'],
appendCodepoints: true,
appendUnicode: false,
normalize: true,
fontHeight: 1000,
centerHorizontally: true
}))
.on('glyphs', function (glyphs, options) {
gulp.src('./skins/webmail2016/assets/css/fonts.scss')
.pipe(consolidate('underscore', {
glyphs: glyphs,
fontName: options.fontName,
fontDate: new Date().getTime()
}))
.pipe(gulp.dest('./skins/webmail2016/assets/fonts'))
.pipe(gulp.dest('./skins/webmail_mobile/assets/fonts'));
})
.pipe(gulp.dest('./skins/webmail2016/assets/fonts'))
.pipe(gulp.dest('./skins/webmail_mobile/assets/fonts'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment