-
Notifications
You must be signed in to change notification settings - Fork 23
/
Gruntfile.js
125 lines (121 loc) · 3.25 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
module.exports = function (grunt) {
//Plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-html2js');
// Tasks
grunt.registerTask('release-watch', ['release', 'watch:release']);
grunt.registerTask('release', ['clean:dist', 'concat', 'uglify:app_main', 'copy:all', 'jshint', 'html2js', 'uglify:app_templates']);
grunt.registerTask('build-watch', ['build', 'watch:build']);
grunt.registerTask('build', ['concat', 'uglify:app_main', 'copy:all', 'jshint', 'html2js', 'uglify:app_templates']);
grunt.registerTask('timestamp', function () {
grunt.log.subhead(Date());
});
// Project configuration.
grunt.initConfig({
app_distdir: 'dist/app',
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> */\n' + '/*! https://github.com/niklr/angular-query-builder */\n',
// variables used for plugins below
src: {
js: ['src/**/*.js'],
html: ['*.html', 'src/**/*.html'],
css: ['*.css'],
},
// directory to be cleaned
clean: {
dist: {
src: ['<%= app_distdir %>/*', '!<%= app_distdir %>/img/**']
}
},
// copies everything from src folder to dest folder (expand true keeps the directory structure)
// makes all src relative to cwd
copy: {
all: {
files: [
{ dest: '<%= app_distdir %>/libraries', src: '**', expand: true, cwd: 'libraries/' },
{ dest: '<%= app_distdir %>/main.js', src: 'main.js' },
{ dest: '<%= app_distdir %>/main.css', src: 'main.css' }
]
}
},
concat: {
app_dist: {
options: {
banner: "<%= banner %>"
},
src: ['<%= src.js %>'],
dest: '<%= app_distdir %>/js/<%= pkg.name %>.js'
},
app_index: {
src: ['index.html'],
dest: '<%= app_distdir %>/index.html',
options: {
process: true
}
}
},
html2js: {
aqb: {
src: ['src/**/*.tpl.html'],
dest: '<%= app_distdir %>/js/angular-query-builder-templates.js'
}
},
uglify: {
app_main: {
options: {
banner: "<%= banner %>"
},
src: '<%= app_distdir %>/js/<%= pkg.name %>.js',
dest: '<%= app_distdir %>/js/<%= pkg.name %>.min.js'
},
app_templates: {
options: {
banner: "<%= banner %>"
},
src: '<%= app_distdir %>/js/angular-query-builder-templates.js',
dest: '<%= app_distdir %>/js/angular-query-builder-templates.min.js'
}
},
watch: {
all: {
files: ['<%= src.js %>', '<%= src.html %>', '<%= src.css %>'],
tasks: ['default', 'timestamp']
},
release: {
files: ['<%= src.js %>', '<%= src.html %>', '<%= src.css %>'],
tasks: ['release', 'timestamp']
},
build: {
files: ['<%= src.js %>', '<%= src.html %>', '<%= src.css %>'],
tasks: ['build', 'timestamp']
}
},
jshint: {
files: ['<%= src.js %>'],
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
boss: true,
eqnull: true,
devel: true,
undef: true,
globals: {
"$": false,
"angular": false,
"_": false
}
}
}
});
};