-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
129 lines (115 loc) · 2.7 KB
/
Gruntfile.js
File metadata and controls
129 lines (115 loc) · 2.7 KB
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
module.exports = function(grunt) {
grunt.initConfig({
// Méta-données
pkg: grunt.file.readJSON("package.json"),
// Fichers que les tâches utiliserons
files: {
html: {
src: "app/index.html"
},
css: {
src: "app/stylesheets/style.css"
},
data: {
src: "app/datas/*.json"
},
js: {
vendor: [
"bower_modules/underscore/underscore-min.js",
"bower_modules/phaser/build/phaser.min.js"
],
app: {
main: "app/javascripts/app.js",
compiled: "generated/js/app.min.js"
}
}
},
// Configurations
browserify: {
app: {
options: {
browserifyOptions: {
debug: true
}
},
files: {
"<%= files.js.app.compiled %>" : "<%= files.js.app.main %>"
}
}
},
concat_sourcemap: {
options: {
sourcesContent: true
},
vendor: {
src: "<%= files.js.vendor %>",
dest: "generated/js/vendor.min.js"
}
},
watch: {
vendor: {
files: ["<%= files.js.vendor %>"],
tasks: ["concat_sourcemap"]
},
js: {
files: ["app/javascripts/**/*.js"],
tasks: ["browserify", "concat_sourcemap"]
},
css: {
files: ["<%= files.css.src %>"],
tasks: ["copy"]
},
html: {
files: ["<%= files.html.src %>"],
tasks: ["copy"]
},
data: {
files: ["<%= files.data.src %>"],
tasks: ["browserify"]
}
},
copy: {
html: {
src: "<%= files.html.src %>",
dest: "generated/",
expand: true,
flatten: true
},
css: {
src: "<%= files.css.src %>",
dest: "generated/css/",
expand: true,
flatten: true
},
image: {
src: "app/images/*.png",
dest: "generated/images/",
expand: true,
flatten: true
},
data: {
src: "<%= files.data.src %>",
dest: "generated/datas/",
expand: true,
flatten: true
}
},
server: {
base: process.env.SERVER_BASE || 'generated',
web: {
port: 3000
}
},
clean: {
workspaces: 'generated'
}
});
// Charge les tâches locales
grunt.loadTasks("tasks");
// Charge les tâches externe (plugins)
// Charge tous mes plugins commençant par "grunt-"
require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks);
// Workflow
grunt.registerTask("default", ["browserify", "concat_sourcemap", "copy", "server", "watch"]);
grunt.registerTask("heroku:production", ["browserify", "concat_sourcemap", "copy"]);
};