-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
142 lines (135 loc) · 4.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
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
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/**
* Todo : implement html min and image min
*/
clean: {
options: {force: true},
dist: ['dist'],
lib: ['demo/client/lib']
},
jshint: {
files: [
'Gruntfile.js',
'src/js/*.js'
],
options: {
jshintrc: true
}
},
compass: {
dist: {
options: {
sassDir: 'src/scss',
cssDir: 'src/css',
}
}
},
html2js: {
options: {
rename: function (moduleName) {
return "ac-templates";
},
base: 'material.autocomplete',
module: 'material.autocomplete.templates',
singleModule: true,
useStrict: true,
quoteChar: '\'',
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
},
main: {
src: ['src/views/template.html'],
dest: 'src/js/autocomplete.template.js'
}
},
concat: {
options: {
force: true,
banner: '/* <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
dist: {
src: ['src/js/autocomplete.js', 'src/js/autocomplete.template.js', 'src/js/autocomplete.directive.js', 'src/js/autocomplete.controller.js'],
dest: 'dist/js/<%= pkg.name %>.js'
}
},
uglify: {
options: {
sourceMap: true,
beautify: true,
banner: '/* <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
jsminify: {
src: ['dist/js/<%= pkg.name %>.js'],
dest: 'dist/js/<%= pkg.name %>.min.js'
}
},
copy: {
css: {
src: 'src/css/*.css',
dest: 'dist/css/<%= pkg.name %>.css'
},
lib: {
expand: true,
cwd: 'dist/',
src: ['**'],
dest: 'demo/client/lib/',
},
},
cssmin: {
cssminify: {
src: 'dist/css/<%= pkg.name %>.css',
dest: 'dist/css/<%= pkg.name %>.min.css'
}
},
run_node: {
start: {
options: {
cwd: 'demo',
detached: false
},
files: {src: ['demo/server/server.js']},
}
},
watch: {
dist: {
files: ['Gruntfile.js', 'src/js/*.js', '!src/js/autocomplete.template.js', 'src/scss/*.scss', 'src/views/*.html'],
tasks: ['clean', 'jshint', 'compass', 'html2js', 'concat', 'uglify', 'copy:css', 'cssmin', 'copy:lib']
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-html2js');
grunt.loadNpmTasks('grunt-run-node');
grunt.registerTask('default', [
'clean',
'jshint',
'compass',
'html2js',
'concat',
'uglify',
'copy:css',
'cssmin',
'copy:lib',
'run_node',
'watch'
]);
};