-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
88 lines (78 loc) · 2.23 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
var path = require('path');
module.exports = function(grunt) {
grunt.initConfig({
cssmin: {
tox_webfont: {
files: {
'fonts/tox-webfont.min.css': ['fonts/*.css']
}
}
},
'string-replace': {
fix_demo_font_path: {
files: [ { 'fonts/tox-webfont.html': 'fonts/tox-webfont.html' } ],
options: {
replacements: [{
pattern: /(tox-webfont\.(eot|svg|ttf|woff))/g,
replacement: 'fonts/$1'
}]
}
},
fix_css_font_path: {
files: [ { 'fonts/tox-webfont.css': 'fonts/tox-webfont.css' } ],
options: {
replacements: [{
pattern: /(tox-webfont\.(eot|svg|ttf|woff))/g,
replacement: '../fonts/$1'
}]
}
}
},
copy: {
main: {
files: [
{ expand: true, cwd: 'fonts/', src: ['*.css'], dest: 'css/', filter: 'isFile' },
{
expand: true, cwd: 'fonts/', src: ['tox-webfont.html'], dest: './', filter: 'isFile',
rename: function(dest, src) {
return 'demo.html';
}
}
]
}
},
_clean: {
after_copy: ['fonts/*.css', 'fonts/*.html'],
build: ['css/', 'demo.html', 'fonts/']
},
webfont: {
icons: {
src: 'submodules/Tox-UI/**/*.svg',
dest: 'fonts',
options: {
font: 'tox-webfont',
hashes: false,
rename: function(name){
return path.basename(name).replace(/_/g, '-');
},
templateOptions: {
baseClass: 'tox-font',
classPrefix: 'tox-font-',
mixinPrefix: 'tox_font_'
},
types: ['eot','woff','ttf','svg']
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-string-replace');
grunt.loadNpmTasks('grunt-webfont');
grunt.renameTask('clean', '_clean');
grunt.registerTask('fix_font_paths', ['string-replace']);
grunt.registerTask('default',
['webfont', 'string-replace', 'cssmin', 'copy:main', '_clean:after_copy']);
grunt.registerTask('clean', ['_clean:build']);
};