-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
88 lines (79 loc) · 2.21 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
module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
// Transpile LESS
less: {
options: {
paths: ['bower_components/bootstrap/less']
},
prod: {
options: {
compress: true,
cleancss: true
},
files: {
"dist/style.css": "src/css/style.less"
}
}
},
// Pre-render Handlebars templates
handlebars: {
options: {
// Returns the filename, with its parent directory if
// it's in a subdirectory of the src/templates folder
processName: function(filePath) {
var path = filePath.toLowerCase(),
pieces = path.split("/"),
name = '';
if(pieces[pieces.length - 2] !== 'templates') {
name = name + pieces[pieces.length - 2];
}
name = name + pieces[pieces.length - 1];
return name.split(".")[0];
}
},
compile: {
files: {
'build/templates.js': ['src/templates/**.hbs']
}
}
},
// Run our JavaScript through JSHint
jshint: {
js: {
src: ['src/js/**.js']
}
},
// Use Uglify to bundle up a pym file for the home page
uglify: {
options: {
sourceMap: true
},
homepage: {
files: {
'dist/scripts.js': [
'bower_components/jquery/dist/jquery.js',
'bower_components/geocomplete/jquery.geocomplete.js',
'bower_components/gmaps/gmaps.js',
'bower_components/underscore/underscore.js',
'bower_components/handlebars/handlebars.runtime.js',
'bower_components/numeral/numeral.js',
'build/templates.js',
'src/js/palette.js',
'src/js/key.js',
'src/js/results.js',
'src/js/map.js',
'src/js/main.js'
]
}
}
}
});
// Load the task plugins
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-handlebars');
grunt.registerTask('default', ['less', 'handlebars', 'jshint', 'uglify']);
};