-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
132 lines (121 loc) · 3.89 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
module.exports = function(grunt) {
var jsPath = 'lib/js',
minPath = 'lib/min',
modelPath = jsPath + '/models';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
all: {
options: {
config: 'config.rb'
}
}
},
bower_concat: {
all: {
dest: minPath + '/libraries.min.js',
dependencies: {
'jquery': 'modernizr',
'lodash': 'jquery',
'hammerjs': 'jquery'
},
exclude: 'jasmine-jquery',
bowerOptions: {
relative: false
}
}
},
jshint: {
source: [
modelPath + '/*.js',
jsPath + '/application.js'
],
afterconcat: [
minPath + '/application.min.js'
]
},
concat: {
application: {
src: [
jsPath + '/Helpers.js',
modelPath + '/Converter.js',
modelPath + '/CategoryMenu.js',
modelPath + '/ConversionWindow.js',
modelPath + '/Calculator.js',
modelPath + '/UnitPicker.js',
modelPath + '/App.js',
jsPath + '/application.js'
],
dest: minPath + '/application.min.js'
}
},
uglify: {
libraries: {
files: {
'lib/min/libraries.min.js': [minPath + '/libraries.min.js']
}
},
application: {
files: {
'lib/min/application.min.js': [minPath + '/application.min.js']
}
}
},
jasmine: {
src : modelPath + '/**/*.js',
options: {
specs : 'tests/*_test.js',
vendor: [
minPath + '/libraries.min.js',
'bower_components/jasmine-jquery/lib/jasmine-jquery.js',
'lib/conversions.js'
],
helpers : [
jsPath + '/Helpers.js'
]
}
},
watch: {
libraries: {
files: ['bower_components/**/*'],
tasks: ['compile-libs']
},
scripts: {
files: [jsPath + '/**/*.js'],
tasks: ['test-js', 'compile-js']
},
tests: {
files: [
'tests/**/*_test.js',
'tests/fixtures/*.html'
],
tasks: ['test-js']
},
css: {
files: ['lib/sass/*.scss'],
tasks: ['compile-css']
}
},
githooks: {
all: {
'pre-commit': 'test-js'
}
}
});
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-bower-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-githooks');
grunt.registerTask('compile-css', ['compass']);
grunt.registerTask('compile-libs', ['bower_concat']);
grunt.registerTask('compile-js', ['jshint:source', 'concat', 'jshint:afterconcat']);
grunt.registerTask('compile', ['compile-css', 'compile-libs', 'compile-js']);
grunt.registerTask('test-js', ['jasmine']);
grunt.registerTask('compile-prod', ['test-js', 'compile', 'uglify']);
grunt.registerTask('default', ['compile', 'watch']);
};