This repository has been archived by the owner on Feb 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
58 lines (54 loc) · 2.02 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*eslint-env node*/
'use strict';
// This is Grunt configuration file
// Grunt is used for pre-processing static assets so they can be served directly by nginx
module.exports = function (grunt) {
// Load plugins
const path = require('path'),
npmTasks = [
'grunt-webfonts'
];
npmTasks.forEach(grunt.loadNpmTasks);
///////////////////////////////////////////////////////////////////////////
// Configuration
///////////////////////////////////////////////////////////////////////////
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
webfont: {
icons: {
src: 'svg/**/*.svg',
dest: 'dist',
destLess: 'dist',
options: {
autoHint: false, // run without installing ttfautohint
engine: 'node',
font: 'svg-icons',
fontFamilyName: 'SVGIcons',
//fontPathVariables: true,
hashes: false,
htmlDemo: true,
normalize: true,
optimize: true,
order: ['woff2', 'woff', 'ttf'],
rename: function (name) {
// consistently use - instead of _
// make sure to not duplicate the prefix "icon-"
return path.basename(name).replace(new RegExp('_', 'g'), '-').replace('icon-', '');
},
stylesheets: ['less'],
syntax: 'bootstrap',
templateOptions: {
classPrefix: 'svg-icon-'
},
types: ['ttf', 'woff2', 'woff']
}
}
}
});
///////////////////////////////////////////////////////////////////////////
// Support tasks
///////////////////////////////////////////////////////////////////////////
grunt.registerTask('default', [
'webfont'
]);
};