-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
119 lines (107 loc) · 3.39 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
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
replace: {
dist: {
src: ['js/config.js'],
overwrite: true,
replacements: [{
from: /debug:(.*?),/g,
to: 'debug: false,'
}]
},
dev: {
src: ['js/config.js'],
overwrite: true,
replacements: [{
from: /debug:(.*?),/g,
to: 'debug: true,'
}]
}
},
compass: {
options: {
config: 'config.rb',
force: true
},
dist: {
options: {
outputStyle: 'compressed',
environment: 'production'
}
},
dev: {
options: {
outputStyle: 'expanded',
environment: 'development'
}
}
},
clean: ['js/build'],
handlebars: {
compile: {
options: {
amd: 'handlebars.runtime',
namespace: false
},
expand: true,
cwd: 'templates',
src: ['**/*.hbs'],
dest: 'js/build/templates',
ext: '.js'
}
},
requirejs: {
options: {
findNestedDependencies: true,
generateSourceMaps: true,
preserveLicenseComments: false,
optimize: 'uglify2',
baseUrl: 'js/',
uglify2: {
output: {
beautify: false,
max_line_len: 1000
},
compress: {
sequences: false,
side_effects: false,
global_defs: { DEBUG: false },
drop_console: true
},
warnings: true,
mangle: false
},
onBuildWrite: function (moduleName, path, contents) {
return '/*! Built on: ' + new Date() + ' */\n' + contents;
}
},
main: {
options: {
mainConfigFile: 'js/main.js',
name: 'main',
out: 'js/build/main.min.js'
}
}
},
watch: {
styles: {
files: ['sass/**/*.scss'],
tasks: ['compass:dev']
},
templates: {
files: ['templates/**/*.hbs'],
tasks: ['clean', 'handlebars']
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-handlebars');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-text-replace');
grunt.registerTask('dist', ['replace:dist', 'compass:dist', 'clean', 'handlebars', 'requirejs']);
grunt.registerTask('dev', ['replace:dev', 'compass:dev', 'clean', 'handlebars']);
grunt.registerTask('default', ['dev', 'watch']);
};