-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
124 lines (105 loc) · 3.05 KB
/
Gruntfile.coffee
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
module.exports = (grunt) ->
@initConfig
PKG: @file.readJSON 'package.json'
APP_NAME: '<%= PKG.name %>'
SRC_DIR: 'src'
DST_DIR: 'dist'
DST_FILE: '<%= DST_DIR %>/main'
INDEX_FILE: 'index.html'
# For the moment grab latest phaser build
# from GH, later on phaser might have Bower support
'curl-dir':
'<%= SRC_DIR %>/js/lib/': [
'https://raw.github.com/photonstorm/phaser/master/build/phaser.js'
]
clean:
options:
force: true
dist: ['<%= DST_DIR %>']
copy:
assets:
files: [
expand: true
flatten: false
cwd: '<%= SRC_DIR %>/assets/'
src: ['**']
dest: '<%= DST_DIR %>/assets/'
]
index:
files: [
src: ['<%= SRC_DIR %>/<%= INDEX_FILE %>]']
expand: false
flatten: true
dest: '<%= DST_DIR %>/<%= INDEX_FILE %>'
]
jshint:
app:
options:
force: true
jshintrc: '.jshintrc'
ignores: ['<%= SRC_DIR %>/js/lib/**/*.js']
src: ['<%= SRC_DIR %>/js/**/*.js']
uglify:
dist:
files:
'<%= DST_FILE %>.min.js': ['<%= SRC_DIR %>/js/**/*.js']
options:
banner: '/*! <%= PKG.name %> v<%= PKG.version %> */\n'
cssmin:
dist:
files:
'<%= DST_FILE %>.min.css': ['<%= SRC_DIR %>/css/**/*.css']
htmlmin:
options:
removeComments: true
removeCommentsFromCDATA: true
removeCDATASectionsFromCDATA: true
collapseWhitespace: true
collapseBooleanAttributes: true
removeAttributeQuotes: true
removeRedundantAttributes: true
useShortDoctype: true
index:
files:
'<%= DST_DIR %>/<%= INDEX_FILE %>': '<%= DST_DIR %>/<%= INDEX_FILE %>'
processhtml:
index:
files:
'<%= DST_DIR %>/<%= INDEX_FILE %>': '<%= SRC_DIR %>/<%=INDEX_FILE %>'
connect:
dev:
options:
port: 9000
base: '<%= SRC_DIR %>'
watch:
js:
files: ['<%= SRC_DIR %>/js/**/*.js']
tasks: ['jshint']
options:
livereload: true
ts:
files: ['<%= SRC_DIR %>/js/**/*.ts']
tasks: ['typescript']
all:
files: [
'<%= SRC_DIR %>/assets/**/*'
'<%= SRC_DIR %>/css/**/*.css'
'<%= SRC_DIR %>/index.html'
]
options:
livereload: true
@loadNpmTasks 'grunt-contrib-copy'
@loadNpmTasks 'grunt-contrib-clean'
@loadNpmTasks 'grunt-contrib-connect'
@loadNpmTasks 'grunt-contrib-jshint'
@loadNpmTasks 'grunt-contrib-uglify'
@loadNpmTasks 'grunt-contrib-cssmin'
@loadNpmTasks 'grunt-contrib-htmlmin'
@loadNpmTasks 'grunt-contrib-watch'
@loadNpmTasks 'grunt-curl'
@loadNpmTasks 'grunt-processhtml'
@registerTask 'dist', ['clean', 'jshint', 'uglify',
'cssmin', 'copy', 'processhtml', 'htmlmin']
@registerTask 'server', ['jshint', 'connect', 'watch']
@registerTask 'update', ['curl-dir']
@registerTask 'default', ['server']