-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
96 lines (88 loc) · 2.74 KB
/
Copy pathGruntfile.js
File metadata and controls
96 lines (88 loc) · 2.74 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
/* custom grunt file made by Rogliano Antoine
great compatibility with RequireJS */
module.exports = function(grunt)
{
'use strict';
var compileSettings = grunt.file.readJSON('compileSettings.json');
grunt.initConfig(
{
// pkg: grunt.file.readJSON('package.json') // TODO - not used yet, improve header making with grunt
clean: {
assets: [ 'release/img/*', 'release/audio/*' ]
}
, requirejs: { // requirejs compil
app: {
options: {
findNestedDependencies : true
, mainConfigFile : '_dev/js/files.js'
, baseUrl : '_dev/js/'
, name : 'main'
, out : 'release/temp/game.js'
, optimize : 'uglify' // uglify or none
, uglify: {
toplevel : true
, ascii_only : true
, beautify : false
, max_line_length : 1000
}
, closure: {
CompilerOptions : {}
,CompilationLevel : 'SIMPLE_OPTIMIZATIONS'
,loggingLevel : 'WARNING'
}
, inlineText: true
, useStrict: false
}
}
}
// create concat foreach platform
, concat: {
web: {
src: [
'HEADER.txt',
'release/temp/game.js'
],
dest: 'release/web/game.js'
}
, w8: {
src: [
'HEADER.txt',
'release/temp/game.js'
],
dest: 'release/w8/game.js'
}
}
// move prod files to prod dir
, copy: { // copy something in given dest
assets: {
expand: true,
flatten: false,
cwd: '_dev',
src: [ 'audio/**/*', 'style.css', 'img/**/*' ],
dest: 'release/_common/'
}
, require: {
expand: true,
flatten: true,
src: [ '_dev/js/ext_libs/require.js' ],
dest: 'release/_common/'
}
}
// replacement for platforms custom
, "string-replace": {
setupW8: compileSettings.platforms.w8.setup
,cleanW8: compileSettings.platforms.w8.clean
}
} );
// Load tasks from "grunt-sample" grunt plugin installed via Npm.
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-string-replace');
// Default task.
grunt.registerTask( 'default', [ 'assets', 'web', 'win8' ] );
grunt.registerTask( 'assets', [ 'clean:assets', 'copy' ] );
grunt.registerTask( 'web', [ 'requirejs', 'concat:web' ] );
grunt.registerTask( 'win8', [ 'string-replace:setupW8', 'requirejs', 'concat:w8', 'string-replace:cleanW8' ] );
};