-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
81 lines (74 loc) · 1.97 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
/*jshint globalstrict:true*/
/*global module:false, process:false*/
'use strict';
var path = require('path');
var connectLR = require('connect-livereload');
// Workaround for Windows giving Error 108 (ERR_ADDRESS_INVALID) when opening 0.0.0.0
var hostname = process.platform !== 'win32' ? '0.0.0.0' : 'localhost';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
jshint: {
game: [
'Gruntfile.js',
'dojoConfig.js',
'src/**/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
clean: {
dist: ['dist/', 'libs/'],
deps: ['deps/', 'node_modules/'],
all: ['<%= clean.dist %>', '<%= clean.deps %>']
},
connect: {
game: {
options: {
middleware: function(connect, options) {
return [connectLR(), connect.static(path.resolve(options.base))];
}
}
},
options: {
hostname: hostname,
port: 8000,
keepalive: false
}
},
open: {
game: {
path: 'http://<%= connect.options.hostname %>:<%= connect.options.port %>/'
}
},
watch: {
game: {
files: ['src/**/*.js', 'styles/**/*.css', 'dojoConfig.js', 'index.html'],
tasks: ['jshint:game'],
options: {
livereload: true
}
}
},
dojo: {
game: {},
options: {
dojo: 'deps/dojo/dojo.js',
profile: 'game.profile.js',
'package': './',
dojoConfig: 'dojoConfig.js',
cwd: './'
}
}
});
grunt.loadNpmTasks('grunt-dojo');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-connect');
// Default task.
grunt.registerTask('default', ['jshint:game', 'connect:game', 'open:game', 'watch:game']);
grunt.registerTask('build', ['jshint:game', 'dojo:game']);
};