forked from opencb/jsorolla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile-threed-viewer.js
114 lines (103 loc) · 4.03 KB
/
Gruntfile-threed-viewer.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
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
def: {
name: 'threed-viewer',
build: 'build/<%= pkg.version %>/<%= def.name %>'
},
concat: {
options: {
banner: '/*! <%= def.name %> <%= grunt.template.today("mmmm dd, yyyy HH:MM:ss") %> */\n'
},
dist: {
src: [
//lib must exists
'build/<%= pkg.version %>/lib.js',
'src/threed-viewer/js/chr.js',
'src/threed-viewer/js/3D.js',
'src/threed-viewer/js/torus.js',
'src/threed-viewer/js/main.js',
'src/threed-viewer/threed-viewer.js'
],
dest: '<%= def.build %>/<%= def.name %>.js'
}
},
uglify: {
options: {
banner: '/*! <%= def.name %> <%= grunt.template.today("mmmm dd, yyyy HH:MM:ss") %> */\n'
},
dist: {
files: {
'<%= def.build %>/<%= def.name %>.min.js': ['<%= concat.dist.dest %>']
}
}
},
copy: {
dist: {
files: [
{ expand: true, cwd: './', src: ['vendor/**'], dest: '<%= def.build %>/' },
{ expand: true, cwd: './', src: ['styles/**'], dest: '<%= def.build %>/' }, // includes files in path and its subdirs
{ expand: true, cwd: './src/<%= def.name %>/', src: ['threedv-config.js'], dest: '<%= def.build %>/' },
{ expand: true, cwd: './src/<%= def.name %>/', src: ['glsl/**'], dest: '<%= def.build %>/' }
]
}
},
clean: {
dist: ['<%= def.build %>/']
},
htmlbuild: {
dist: {
src: 'src/<%= def.name %>/<%= def.name %>.html',
dest: '<%= def.build %>/',
options: {
beautify: true,
styles: {
'vendor': [
],
'css': ['<%= def.build %>/styles/css/style.css']
},
scripts: {
'vendor': [
'<%= def.build %>/vendor/underscore*.js',
'<%= def.build %>/vendor/backbone*.js',
'<%= def.build %>/vendor/jquery.min.js',
// '<%= def.build %>/vendor/core/embed.js',
'<%= def.build %>/vendor/three.js',
'<%= def.build %>/vendor/Stats.js',
'<%= def.build %>/vendor/RequestAnimationFrame.js',
'<%= def.build %>/vendor/dat.gui.min.js',
],
'js': '<%= def.build %>/<%= def.name %>.min.js'
}
}
}
},
rename: {
dist: {
files: [
{
src: ['<%= def.build %>/<%= def.name %>.html'],
dest: '<%= def.build %>/index.html'
}
]
}
},
hub: {
lib: {
src: ['Gruntfile-lib.js'],
tasks: ['default']
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-html-build');
grunt.loadNpmTasks('grunt-contrib-rename');
grunt.loadNpmTasks('grunt-hub');
grunt.registerTask('vendor', ['curl-dir']);
grunt.registerTask('default', ['hub:lib', 'clean', 'concat', 'uglify', 'copy', 'htmlbuild', 'rename']);
grunt.registerTask('no-dep', ['clean', 'concat', 'uglify', 'copy', 'htmlbuild', 'rename']);
};