-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathGruntfile.js
122 lines (117 loc) · 2.65 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
/*global module:false*/
module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: '/**\n' + ' * <%= pkg.name %> - <%= pkg.description %>\n' +
' * @version <%= pkg.version %> - ' +
'built on <%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * @link <%= pkg.homepage %>\n' +
' * @license MIT License, Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' + ' */\n',
clean: {
files: ['min', ['src/template/*.js']]
},
uglify: {
options: {
banner: '<%= banner %>',
mangle: true,
compress: {
booleans: true,
cascade: true,
comparisons: true,
conditionals: true,
dead_code: true,
drop_console: true,
if_return: true,
join_vars: true,
loops: true,
properties: true,
pure_getters: true,
sequences: true,
unused: true,
}
},
min: {
files: {
'min/ng-scrollable.min.js': ['src/*.js']
}
}
},
html2js: {
src: ['src/template/*.html']
},
jshint: {
gruntfile: {
options: {
jshintrc: '.jshintrc'
},
src: 'Gruntfile.js'
},
src: {
options: {
jshintrc: '.jshintrc'
},
src: 'src/*.js'
}
},
csslint: {
strict: {
options: {
csslintrc: '.csslintrc',
'import': 2
},
src: ['assets/*.css']
}
},
cssmin: {
options: {
banner: '<%= banner %>'
},
minify: {
expand: true,
cwd: 'assets/',
src: ['*.css'],
dest: 'min/',
ext: '.min.css'
}
},
watch: {
css: {
files: 'assets/*.css',
tasks: ['csslint', 'cssmin']
},
js: {
files: 'src/*.js',
tasks: ['jshint', 'uglify']
},
livereload: {
// Browser live reloading
// https://github.com/gruntjs/grunt-contrib-watch#live-reloading
files: [
'example/*',
'min/*'
],
options: {
livereload: true
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', 'Usage', function () {
grunt.log.writeln();
grunt.log.writeln("Usage");
grunt.log.writeln("grunt lint - check source files");
grunt.log.writeln("grunt build - build minified version");
grunt.log.writeln("grunt serve - build minified version and watch files");
});
grunt.registerTask('lint', ['jshint', 'csslint']);
grunt.registerTask('build', ['clean', 'lint', 'uglify', 'cssmin']);
grunt.registerTask('serve', ['build', 'watch']);
};