-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
137 lines (136 loc) · 4.56 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
133
134
135
136
137
module.exports = function(grunt) {
grunt.initConfig({
clean: ["dump/", "production/"],
coffee: {
app: {
src: ["app/**/*.coffee"],
dest: "dump/javascript",
ext: '.js',
expand: true,
options: {
bare: true
}
}
},
handlebars: {
all: {
options: {
wrapped: true,
processName: function(path) {
var pieces;
pieces = path.split("/");
return pieces[pieces.length - 1].replace(/\.hbs$/, "");
}
},
files: {
"dump/javascript/templates.js": ["app/views/templates/*.hbs"]
}
}
},
concat: {
app: {
src: ["dump/javascript/templates.js", "dump/javascript/app/init.js", "dump/javascript/app/application.js", "dump/javascript/app/router.js", "dump/javascript/app/utils/**/*.js", "dump/javascript/app/controllers/**/*.js", "dump/javascript/app/models/**/*.js", "dump/javascript/app/collections/**/*.js", "dump/javascript/app/views/base/*.js", "dump/javascript/app/views/*.js"],
dest: "public/javascript/app.js"
},
vendor: {
src: ["vendor/scripts/jquery-1.8.3.js", "vendor/scripts/underscore-1.4.3.js", "vendor/scripts/backbone-1.0.0.js", "vendor/scripts/backbone.localStorage.js", "vendor/scripts/handlebars.js", "vendor/scripts/handlebars-helpers.js", "vendor/scripts/console-helper.js", "vendor/scripts/jquery.serializeToJSON.js", "vendor/scripts/sound-manager2.js", "vendor/scripts/gapless.js", "vendor/scripts/jquery.powertip.js"],
dest: "public/javascript/vendor.js"
}
},
cssmin: {
app: {
files: {
"production/index.css": ["public/css/index.css"]
}
}
},
stylus: {
compile: {
files: {
"public/css/index.css": ["app/views/styles/bootstrap.styl", "app/views/styles/gapless.styl", "app/views/styles/application.styl", "app/views/styles/header.styl", "app/views/styles/footer.styl", "app/views/styles/index.styl", "app/views/styles/home-page.styl", "app/views/styles/login-page.styl", "app/views/styles/player.styl", "app/views/styles/playlists.styl", "app/views/styles/playlist.styl", "app/views/styles/edit-playlist.styl", "app/views/styles/queue.styl", "app/views/styles/about.styl", "app/views/styles/powerTip.styl"]
}
}
},
uglify: {
app: {
files: {
"production/gd.min.js": ["public/javascript/vendor.js", "public/javascript/app.js"]
}
}
},
watch: {
compile: {
files: ["app/**/*.coffee"],
tasks: ["compile:coffee"]
},
vendor: {
files: ["vendor/**/*.js"],
tasks: ["concat:vendor", "clean"]
},
handlebars: {
files: ["app/views/templates/*.hbs"],
tasks: ["compile:coffee"]
},
stylus: {
files: ["app/views/styles/**/*.styl"],
tasks: ["stylus"]
}
},
copy: {
production: {
files: [
{
src: ["public/img/*"],
dest: "production/img/"
}, {
src: ["public/index.html"],
dest: "production/index.html"
}
]
}
},
compress: {
js: {
options: {
mode: 'gzip'
},
src: ['production/gd.min.js'],
dest: 'production/gd.min.js'
},
css: {
options: {
mode: 'gzip'
},
src: ['production/index.css'],
dest: 'production/index.css'
}
},
rename: {
production: {
files: [
{
src: 'production/gd.min.js.gz',
dest: 'production/gd.min.js'
}, {
src: 'production/index.css.gz',
dest: 'production/index.css'
}
]
}
}
});
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-coffee");
grunt.loadNpmTasks("grunt-contrib-handlebars");
grunt.loadNpmTasks("grunt-contrib-stylus");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-rename');
grunt.registerTask("compile", ["coffee", "handlebars", "concat", "stylus", "clean"]);
grunt.registerTask("compile:coffee", ["coffee", "handlebars", "concat", "clean"]);
return grunt.registerTask("production", ["coffee", "handlebars", "concat", "stylus", "clean", "copy:production", "cssmin", "uglify", "rename"]);
};