forked from joypixels/emojione
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
105 lines (103 loc) · 3.44 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
files: ['gruntfile.js', 'lib/js/emojione.js']
},
jsonlint: {
files: {
src: ['emoji.json','emoji_strategy.json']
}
},
// BUILD PNG SPRITES
sprite:{
pngsprites: {
src: 'assets/png/*.png',
dest: 'assets/sprites/emojione.sprites.png',
destCss: 'assets/sprites/emojione.sprites.scss',
'cssTemplate': 'assets/sprites/emojione.sprites.mustache',
'algorithm': 'binary-tree',
'cssVarMap': function (sprite) {
sprite.name = 'emojione-' + sprite.name;
}
}
},
// BUILD PNG SPRITES (SASS -> CSS)
sass: {
dist: {
options: {
'sourcemap': 'none'
},
files: {
'assets/sprites/emojione.sprites.css': 'assets/sprites/emojione.sprites.scss',
'assets/css/emojione-awesome.css': 'lib/emojione-awesome/emojione-awesome.scss'
}
}
},
// BUILD SVG SPRITES
svgstore: {
options: {
prefix : 'emoji-', // symbol ID prefix
svg: {
viewBox : '0 0 64 64',
xmlns: 'http://www.w3.org/2000/svg',
"xmlns:xlink": "http://www.w3.org/1999/xlink"
}
},
default : {
files: {
'assets/sprites/emojione.sprites.svg': ['assets/svg/*.svg']
}
}
},
uglify: {
options: {
// the banner is inserted at the top of the output
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
dist: {
files: {
'lib/js/<%= pkg.name %>.min.js': ['lib/js/<%= pkg.name %>.js']
}
}
},
// OPTIMIZE PNGs
imageoptim: {
pngs: {
src: ['assets/png', 'assets/png']
},
sprite: {
src: ['assets/sprites', 'assets/sprites']
}
},
// Minify Project CSS
cssmin: {
target: {
files: {
'assets/css/emojione.min.css': ['assets/css/emojione.css'],
'assets/sprites/emojione.sprites.css': ['assets/sprites/emojione.sprites.css']
}
}
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint']
},
// run QUnit tests
qunit: {
all: ['lib/js/tests/tests.html']
}
});
grunt.loadNpmTasks('grunt-spritesmith');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-svgstore');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jsonlint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-imageoptim');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.registerTask('default', ['jshint','jsonlint', 'sprite:pngsprites', 'sass', 'svgstore', 'uglify', 'cssmin', 'imageoptim']);
grunt.registerTask('travis', ['qunit']);
};