-
Notifications
You must be signed in to change notification settings - Fork 19
/
Gruntfile.js
110 lines (93 loc) · 2.88 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
banner:
'/*!\n' +
' * <%= pkg.name %> <%= pkg.version %>\n' +
' *\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %> AdRoll\n' +
' * <%= pkg.license %> license\n' +
' * <%= pkg.url %>\n' +
' */'
},
clean: {
release: ['dist']
},
preprocess: {
options: {
context: {
VERSION: '<%= pkg.version %>',
BANNER: '<%= meta.banner %>'
}
},
scripts: {
files: {
'dist/<%= pkg.name %>.js': 'src/core.js'
}
},
styles: {
files: {
'dist/<%= pkg.name %>.css': 'src/core.css'
}
}
},
uglify: {
options: {
preserveComments: 'some',
report: 'gzip'
},
release: {
files: {
'dist/<%= pkg.name %>.min.js': 'dist/<%= pkg.name %>.js'
}
}
},
cssmin: {
options: {
report: 'gzip'
},
release: {
files: {
'dist/<%= pkg.name %>.min.css': 'dist/<%= pkg.name %>.css'
}
}
},
jshint: {
options: {
ignores: ['test/vendor/**/*.js']
},
scripts: ['Gruntfile.js', 'src/**/*.js'],
test: ['test/**/*.js']
},
watch: {
scripts: {
files: ['Gruntfile.js', 'src/**/*.js'],
tasks: ['jshint:scripts', 'preprocess:scripts']
},
styles: {
files: ['src/**/*.css'],
tasks: ['preprocess:styles']
},
test: {
files: ['test/**/*.js'],
tasks: ['jshint:test']
}
},
mocha_phantomjs: {
all: ['test/**/*.html']
}
});
grunt.loadNpmTasks('grunt-mocha-phantomjs');
grunt.loadNpmTasks('grunt-preprocess');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('test', ['jshint', 'mocha_phantomjs']);
grunt.registerTask('dev', ['jshint', 'preprocess', 'watch']);
grunt.registerTask('release', ['clean:release', 'preprocess',
'uglify:release', 'cssmin:release']);
grunt.registerTask('default', ['release']);
};