-
Notifications
You must be signed in to change notification settings - Fork 67
/
Gruntfile.js
89 lines (84 loc) · 2.16 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
/*global module,require*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('iris.jquery.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: ['src/<%= pkg.name %>.js', 'libs/color.js'],
dest: 'dist/<%= pkg.name %>.js'
},
basic: {
src: ['src/<%= pkg.name %>.js'],
dest: 'dist/<%= pkg.name %>-basic.js'
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/<%= pkg.name %>.min.js'
},
basic: {
src: ['<%= concat.basic.dest %>'],
dest: 'dist/<%= pkg.name %>-basic.min.js'
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: {
src: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js']
}
},
cssmin: {
dist: {
src: ['src/iris.css'],
dest: 'src/iris.min.css'
}
},
replace: {
dist: {
options: {
patterns: [{
match: /_css = '.+';$/m,
replacement: function() {
var css = grunt.file.read( 'src/iris.min.css' );
return '_css = \'' + css + '\';';
}
}]
},
files: [{
src: [ 'src/iris.js' ],
dest: 'src/iris.js'
}]
}
},
watch: {
js: {
files: [ 'src/iris.js' ],
tasks: [ 'concat', 'uglify' ]
},
css: {
files: [ 'src/iris.css' ],
tasks: [ 'css' ]
}
}
});
require( 'load-grunt-tasks' )( grunt );
grunt.registerTask('css', ['cssmin', 'replace']);
// Default task.
grunt.registerTask('default', 'css jshint concat uglify'.split(' ') );
};