-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathGruntfile.js
executable file
·157 lines (141 loc) · 4.07 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
development: {
options: {
paths: ['styles/']
},
files: {
'styles/css/main.css': 'styles/less/main.less',
'styles/css/default-theme.css': 'styles/less/default-theme.less',
'styles/css/clutterboard-theme.css': 'styles/less/clutterboard-theme.less'
}
}
},
cssmin: {
options: {
shorthandCompacting: false,
roundingPrecision: -1
},
target: {
files: {
'dist/mtr-datepicker.min.css': ['styles/css/main.css'],
'dist/mtr-datepicker.default-theme.min.css': ['styles/css/default-theme.css'],
'dist/mtr-datepicker.clutterboard-theme.min.css': ['styles/css/clutterboard-theme.css']
}
}
},
uglify: {
options: {
beautify: true
},
lib_target: {
files: {
'dist/mtr-datepicker.min.js': ['scripts/mtr-datepicker.js']
}
},
timezones_target: {
files: {
'dist/mtr-datepicker-timezones.min.js': ['scripts/mtr-datepicker-timezones.js']
}
}
},
// Append a timestamp to JS and CSS files which are located in 'index.html'
cachebreaker: {
dev: {
options: {
match: [
// CSS
'dist/mtr-datepicker.min.css',
'dist/mtr-datepicker.default-theme.min.css',
// JS
'dist/mtr-datepicker.min.js'
]
},
files: {
src: ['index.html']
}
}
},
jsdoc: {
dist: {
src: ['scripts/*.js'],
options: {
destination: 'docs'
}
}
},
jshint: {
all: ['scripts/*.js', 'test/spec/**/*.js']
},
watch: {
options: {
livereload: true
},
less: {
options: {
livereload: false
},
files: ['styles/less/*.less', 'scripts/*.js'],
tasks: ['less', 'cssmin', 'uglify', 'notify:watch', 'cachebreaker', 'jsdoc']
}
},
connect: {
server: {
options: {
port: 4200,
hostname: '*'
}
}
},
coveralls: {
// Options relevant to all targets
options: {
// When true, grunt-coveralls will only print a warning rather than
// an error, to prevent CI builds from failing unnecessarily (e.g. if
// coveralls.io is down). Optional, defaults to false.
force: false
},
your_target: {
// LCOV coverage file (can be string, glob or array)
src: 'tests/coverage/lcov.info',
options: {
// Any options for just this target
}
}
},
notify_hooks: {
options: {
enabled: true,
max_jshint_notifications: 5, // maximum number of notifications from jshint output
title: 'MTR Datepicker', // defaults to the name in package.json, or will use project directory's name
success: false, // whether successful grunt executions should be notified automatically
duration: 1 // the duration of notification in seconds, for `notify-send only
}
},
notify: {
watch: {
options: {
title: 'Watch Detected',
message: 'LESS and minification finished.'
}
}
}
});
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-cache-breaker');
grunt.loadNpmTasks('grunt-notify');
grunt.loadNpmTasks('grunt-karma-coveralls');
grunt.loadNpmTasks('grunt-coveralls');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.task.run('notify_hooks');
grunt.registerTask('default', ['less', 'cssmin', 'uglify', 'cachebreaker', 'jsdoc', 'connect', 'watch']);
grunt.registerTask('coverage', ['coveralls:your_target']);
};