-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
218 lines (209 loc) · 8.44 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-concat-sourcemap');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-yuidoc');
grunt.loadTasks('tasks');
var srcFiles = [
'<%= dirs.src %>/Intro.js',
'<%= dirs.src %>/Pixi.js',
'<%= dirs.src %>/core/Point.js',
'<%= dirs.src %>/core/Rectangle.js',
'<%= dirs.src %>/core/Polygon.js',
'<%= dirs.src %>/core/Circle.js',
'<%= dirs.src %>/core/Ellipse.js',
'<%= dirs.src %>/core/Matrix.js',
'<%= dirs.src %>/display/DisplayObject.js',
'<%= dirs.src %>/display/DisplayObjectContainer.js',
'<%= dirs.src %>/display/Sprite.js',
'<%= dirs.src %>/display/SpriteBatch.js',
'<%= dirs.src %>/display/MovieClip.js',
'<%= dirs.src %>/filters/FilterBlock.js',
'<%= dirs.src %>/text/Text.js',
'<%= dirs.src %>/text/BitmapText.js',
'<%= dirs.src %>/InteractionData.js',
'<%= dirs.src %>/InteractionManager.js',
'<%= dirs.src %>/display/Stage.js',
'<%= dirs.src %>/utils/Utils.js',
'<%= dirs.src %>/utils/EventTarget.js',
'<%= dirs.src %>/utils/Detector.js',
'<%= dirs.src %>/utils/Polyk.js',
'<%= dirs.src %>/renderers/webgl/utils/WebGLShaderUtils.js',
'<%= dirs.src %>/renderers/webgl/shaders/PixiShader.js',
'<%= dirs.src %>/renderers/webgl/shaders/PixiFastShader.js',
'<%= dirs.src %>/renderers/webgl/shaders/StripShader.js',
'<%= dirs.src %>/renderers/webgl/shaders/PrimitiveShader.js',
'<%= dirs.src %>/renderers/webgl/utils/WebGLGraphics.js',
'<%= dirs.src %>/renderers/webgl/WebGLRenderer.js',
'<%= dirs.src %>/renderers/webgl/utils/WebGLMaskManager.js',
'<%= dirs.src %>/renderers/webgl/utils/WebGLShaderManager.js',
'<%= dirs.src %>/renderers/webgl/utils/WebGLSpriteBatch.js',
'<%= dirs.src %>/renderers/webgl/utils/WebGLFastSpriteBatch.js',
'<%= dirs.src %>/renderers/webgl/utils/WebGLFilterManager.js',
'<%= dirs.src %>/renderers/webgl/utils/FilterTexture.js',
'<%= dirs.src %>/renderers/canvas/utils/CanvasMaskManager.js',
'<%= dirs.src %>/renderers/canvas/utils/CanvasTinter.js',
'<%= dirs.src %>/renderers/canvas/CanvasRenderer.js',
'<%= dirs.src %>/renderers/canvas/CanvasGraphics.js',
'<%= dirs.src %>/primitives/Graphics.js',
'<%= dirs.src %>/extras/Strip.js',
'<%= dirs.src %>/extras/Rope.js',
'<%= dirs.src %>/extras/TilingSprite.js',
'<%= dirs.src %>/extras/Spine.js',
'<%= dirs.src %>/textures/BaseTexture.js',
'<%= dirs.src %>/textures/Texture.js',
'<%= dirs.src %>/textures/RenderTexture.js',
'<%= dirs.src %>/loaders/AssetLoader.js',
'<%= dirs.src %>/loaders/JsonLoader.js',
'<%= dirs.src %>/loaders/AtlasLoader.js',
'<%= dirs.src %>/loaders/SpriteSheetLoader.js',
'<%= dirs.src %>/loaders/ImageLoader.js',
'<%= dirs.src %>/loaders/BitmapFontLoader.js',
'<%= dirs.src %>/loaders/SpineLoader.js',
'<%= dirs.src %>/filters/AbstractFilter.js',
'<%= dirs.src %>/filters/AlphaMaskFilter.js',
'<%= dirs.src %>/filters/ColorMatrixFilter.js',
'<%= dirs.src %>/filters/GrayFilter.js',
'<%= dirs.src %>/filters/DisplacementFilter.js',
'<%= dirs.src %>/filters/PixelateFilter.js',
'<%= dirs.src %>/filters/BlurXFilter.js',
'<%= dirs.src %>/filters/BlurYFilter.js',
'<%= dirs.src %>/filters/BlurFilter.js',
'<%= dirs.src %>/filters/InvertFilter.js',
'<%= dirs.src %>/filters/SepiaFilter.js',
'<%= dirs.src %>/filters/TwistFilter.js',
'<%= dirs.src %>/filters/ColorStepFilter.js',
'<%= dirs.src %>/filters/DotScreenFilter.js',
'<%= dirs.src %>/filters/CrossHatchFilter.js',
'<%= dirs.src %>/filters/RGBSplitFilter.js',
'<%= dirs.src %>/Outro.js'
],
banner = [
'/**',
' * @license',
' * <%= pkg.name %> - v<%= pkg.version %>',
' * Copyright (c) 2012-2014, Mat Groves',
' * <%= pkg.homepage %>',
' *',
' * Compiled: <%= grunt.template.today("yyyy-mm-dd") %>',
' *',
' * <%= pkg.name %> is licensed under the <%= pkg.license %> License.',
' * <%= pkg.licenseUrl %>',
' */',
''
].join('\n');
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
dirs: {
build: 'bin',
docs: 'docs',
src: 'src/pixi',
test: 'test'
},
files: {
srcBlob: '<%= dirs.src %>/**/*.js',
testBlob: '<%= dirs.test %>/**/*.js',
testConf: '<%= dirs.test %>/karma.conf.js',
build: '<%= dirs.build %>/pixi.dev.js',
buildMin: '<%= dirs.build %>/pixi.js'
},
concat: {
options: {
banner: banner
},
dist: {
src: srcFiles,
dest: '<%= files.build %>'
}
},
/* jshint -W106 */
concat_sourcemap: {
dev: {
files: {
'<%= files.build %>': srcFiles
},
options: {
sourceRoot: '../'
}
}
},
jshint: {
options: {
jshintrc: './.jshintrc'
},
source: {
src: srcFiles.concat('Gruntfile.js'),
options: {
ignores: '<%= dirs.src %>/**/{Intro,Outro,Spine,Pixi}.js'
}
},
test: {
src: ['<%= files.testBlob %>'],
options: {
ignores: '<%= dirs.test %>/lib/resemble.js',
jshintrc: undefined, //don't use jshintrc for tests
expr: true,
undef: false,
camelcase: false
}
}
},
uglify: {
options: {
banner: banner
},
dist: {
src: '<%= files.build %>',
dest: '<%= files.buildMin %>'
}
},
connect: {
test: {
options: {
port: grunt.option('port-test') || 9002,
base: './',
keepalive: true
}
}
},
yuidoc: {
compile: {
name: '<%= pkg.name %>',
description: '<%= pkg.description %>',
version: '<%= pkg.version %>',
url: '<%= pkg.homepage %>',
logo: '<%= pkg.logo %>',
options: {
paths: '<%= dirs.src %>',
outdir: '<%= dirs.docs %>'
}
}
},
watch: {
scripts: {
files: ['<%= dirs.src %>/**/*.js'],
tasks: ['concat'],
options: {
spawn: false,
}
}
},
karma: {
unit: {
configFile: '<%= files.testConf %>',
// browsers: ['Chrome'],
singleRun: true
}
}
});
grunt.registerTask('default', ['build', 'test']);
grunt.registerTask('build', ['jshint:source', 'concat', 'uglify']);
grunt.registerTask('build-debug', ['concat_sourcemap', 'uglify']);
grunt.registerTask('test', ['concat', 'jshint:test', 'karma']);
grunt.registerTask('docs', ['yuidoc']);
grunt.registerTask('travis', ['build', 'test']);
grunt.registerTask('default', ['build', 'test']);
grunt.registerTask('debug-watch', ['concat', 'watch']);
};