forked from mediaelement/mediaelement
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
179 lines (172 loc) · 7.03 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
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadNpmTasks("grunt-remove-logging");
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
me: {
src: [
'src/js/me-header.js',
'src/js/me-namespace.js',
'src/js/me-utility.js',
'src/js/me-plugindetector.js',
'src/js/me-featuredetection.js',
'src/js/me-mediaelements.js',
'src/js/me-shim.js',
'src/js/me-i18n.js',
'src/js/me-i18n-locale-de.js',
'src/js/me-i18n-locale-zh.js'
],
dest: 'local-build/mediaelement.js'
},
mep: {
src: [
'src/js/mep-header.js',
'src/js/mep-library.js',
'src/js/mep-player.js',
'src/js/mep-feature-playpause.js',
'src/js/mep-feature-stop.js',
'src/js/mep-feature-progress.js',
'src/js/mep-feature-time.js',
'src/js/mep-feature-volume.js',
'src/js/mep-feature-fullscreen.js',
'src/js/mep-feature-speed.js',
'src/js/mep-feature-tracks.js',
'src/js/mep-feature-contextmenu.js',
'src/js/mep-feature-postroll.js'
],
dest: 'local-build/mediaelementplayer.js'
},
bundle: {
src: [
'local-build/mediaelement.js',
'local-build/mediaelementplayer.js'
],
dest: 'local-build/mediaelement-and-player.js'
}
},
removelogging: {
dist: {
src: [
'local-build/mediaelement.js',
'local-build/mediaelementplayer.js',
'local-build/mediaelement-and-player.js'
]
},
options: {
// Keep `warn` and other methods from the console API
methods: ['log']
}
},
uglify: {
me: {
src : ['local-build/mediaelement.js'],
dest : 'local-build/mediaelement.min.js',
banner : 'src/js/me-header.js'
},
mep: {
src : ['local-build/mediaelementplayer.js'],
dest : 'local-build/mediaelementplayer.min.js',
banner : 'src/js/mep-header.js'
},
bundle: {
src : ['local-build/mediaelement-and-player.js'],
dest : 'local-build/mediaelement-and-player.min.js'
},
options: {
// Preserve comments that start with a bang (like the file header)
preserveComments: "some"
}
},
cssmin: {
build: {
src : ['src/css/mediaelementplayer.css'],
dest : 'local-build/mediaelementplayer.min.css'
}
},
copy: {
build: {
expand : true,
cwd : 'src/css/',
src : ['*.png', '*.svg', '*.gif', '*.css'],
dest : 'local-build/',
flatten : true,
filter : 'isFile'
}
},
replace: {
cdnBuild: {
src: ['src/flash/FlashMediaElement.as'],
dest: 'tmp/FlashMediaElement.as',
replacements: [{
from: '//Security.allowDomain("*");',
to: 'Security.allowDomain("*");'
}, {
from: '//Security.allowInsecureDomain("*");',
to: 'Security.allowInsecureDomain("*");'
}]
}
},
clean: {
build: ['local-build'],
temp: ['tmp']
},
// Task that compiles flashmediaelement.swf using the free Flex SDK on Linux/Mac.
// There are a few prerequisite steps involved in running this task.
//
// 1) Install the Flex SDK version 4.6 (only needs to be done once)
// Download the free flex sdk from http://sourceforge.net/adobe/flexsdk/wiki/Download%20Flex%204.6/
// Unzip it to a directory on your local machine (eg: /usr/local/flex_sdk_4.6)
// Create a symlink from the install location to this directory
// (eg: ln -s /usr/local/flex_sdk_4.6 mediaelement/src/flash)
//
// 2) Update the `flexPath` variable below to reflect the name of the symlink you created
//
// 3) Build the SWC file (only needs to be done if you have changed something in the FLA file)
// Open the FlashMediaElement.fla file in the Flash Professional IDE.
// Goto the menu item 'File->Publish Settings'
// Click the 'Flash' tab
// Make sure the box 'Export SWC' is checked
// Click 'Publish'
// Quit out of the Flash IDE
//
// 4) Run this task from the command line: `grunt shell:buildFlash`
//
// Note: There doesn't seem to be an available SWC library that defines the YouTube player API.
// Remove the -strict compiler option to see warnings coming from YouTube API calls.
//
flexPath: '../flex_sdk_4.6',
buildFlashCommand: [
'<%= flexPath %>/bin/mxmlc -strict=false -warnings=true',
'<%= flashIn %> -o <%= flashOut %>',
'-library-path+="<%= flexPath %>/lib"',
'-include-libraries+=src/flash/flashmediaelement.swc',
'-include-libraries+=src/flash/flashls.swc -use-network=true',
'-headless-server -static-link-runtime-shared-libraries'
].join(" "),
shell: {
buildFlash: {
command: function() {
grunt.config.set("flashIn", 'src/flash/FlashMediaElement.as');
grunt.config.set("flashOut", 'local-build/flashmediaelement.swf');
return grunt.config.get("buildFlashCommand");
}
},
buildFlashCDN: {
command: function() {
grunt.config.set("flashIn", 'tmp/FlashMediaElement.as');
grunt.config.set("flashOut", 'local-build/flashmediaelement-cdn.swf');
return grunt.config.get("buildFlashCommand");
}
}
}
});
grunt.registerTask('default', ['concat', 'removelogging', 'uglify', 'cssmin', 'copy',
'shell:buildFlash', 'replace:cdnBuild', 'shell:buildFlashCDN', 'clean:temp']);
};