forked from jywarren/image-sequencer
-
Notifications
You must be signed in to change notification settings - Fork 210
/
Gruntfile.js
106 lines (98 loc) · 2.98 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
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify-es');
grunt.loadNpmTasks('grunt-browser-sync');
grunt.loadNpmTasks('grunt-text-replace');
require('matchdep')
.filterDev('grunt-*')
.forEach(grunt.loadNpmTasks);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
options: {
livereload: true
},
source: {
files: ['src/**/*', 'Gruntfile.js', 'examples/lib/*', 'examples/demo.js'],
tasks: ['compile']
}
},
browserify: {
options: {
alias: {
'gpu.js': './node_modules/gpu.js/src/index.js'
}
},
core: {
src: ['src/ImageSequencer.js'],
dest: 'dist/image-sequencer.js'
},
ui: {
src: ['examples/demo.js'],
dest: 'dist/image-sequencer-ui.js'
},
prodcore: {
src: ['src/ImageSequencer.js'],
dest: 'dist/image-sequencer.brow.js'
},
produi: {
src: ['examples/demo.js'],
dest: 'dist/image-sequencer-ui.brow.js'
},
tests: {
src: ['test/core/sequencer/meta-modules.js',
'test/core/sequencer/image-sequencer.js',
'test/core/sequencer/chain.js',
'test/core/sequencer/replace.js',
'test/core/sequencer/import-export.js',
'test/core/sequencer/run.js',
'test/core/sequencer/dynamic-imports.js',
'test/core/util/*.js'],
dest: './output/core-tests.js'
}
},
replace: {
version: {
src: ['examples/sw.js'],
overwrite: true,
replacements: [{
from: /image-sequencer-static-v.*/g,
to: "image-sequencer-static-v<%= pkg.version %>';"
}]
}
},
uglify: {
core: {
src: ['./dist/image-sequencer.js'],
dest: './dist/image-sequencer.min.js'
},
ui: {
src: ['dist/image-sequencer-ui.js'],
dest: 'dist/image-sequencer-ui.min.js'
},
prodcore: {
src: ['dist/image-sequencer.brow.js'],
dest: 'dist/image-sequencer.js'
},
produi: {
src: ['dist/image-sequencer-ui.brow.js'],
dest: 'dist/image-sequencer-ui.js'
}
},
browserSync: {
dev: {
options: {
watchTask: true,
server: './'
}
}
}
});
/* Default (development): Watch files and build on change. */
grunt.registerTask('default', ['watch']);
grunt.registerTask('build', ['browserify:core', 'browserify:ui', 'replace:version', 'uglify:core', 'uglify:ui']);
grunt.registerTask('serve', ['browserify:core', 'browserify:ui', 'replace:version', 'browserSync', 'watch']);
grunt.registerTask('compile', ['browserify:core', 'browserify:ui']);
grunt.registerTask('production', ['browserify:prodcore', 'browserify:produi', 'replace:version', 'uglify:prodcore', 'uglify:produi']);
grunt.registerTask('tests', ['browserify:tests']);
};