1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-10 23:30:03 +02:00

@misteroneill create video.novtt.js in dist builds. closes #2447

This commit is contained in:
Pat O'Neill 2015-08-10 15:22:15 -04:00 committed by David LaPalomento
parent 67c0d999cc
commit c0673d2852
4 changed files with 54 additions and 7 deletions

View File

@ -90,6 +90,7 @@ CHANGELOG
* @misteroneill removed the deprecated Component init method ([view](https://github.com/videojs/video.js/pull/2427))
* @misteroneill restore videojs.formatTime ([view](https://github.com/videojs/video.js/pull/2420))
* @misteroneill include child components with `true` in options ([view](https://github.com/videojs/video.js/pull/2424))
* @misteroneill create video.novtt.js in dist builds ([view](https://github.com/videojs/video.js/pull/2447))
--------------------

View File

@ -1,11 +1,11 @@
/**
* @license
* Video.js <%= pkg.version %> <http://videojs.com/>
* <%= pkg.copyright %>
* Video.js <%= version %> <http://videojs.com/>
* <%= copyright %>
* Available under Apache License Version 2.0
* <https://github.com/videojs/video.js/blob/master/LICENSE>
*
<% if (includesVtt) { %> *
* Includes vtt.js <https://github.com/mozilla/vtt.js>
* Available under Apache License Version 2.0
* <https://github.com/mozilla/vtt.js/blob/master/LICENSE>
*/
<% } %> */

View File

@ -1,8 +1,10 @@
module.exports = function(grunt) {
require('time-grunt')(grunt);
let _ = require('lodash-compat');
let pkg = grunt.file.readJSON('package.json');
let license = grunt.file.read('build/license-header.txt');
let bannerCommonData = _.pick(pkg, ['version', 'copyright']);
let verParts = pkg.version.split('.');
let version = {
full: pkg.version,
@ -11,6 +13,22 @@ module.exports = function(grunt) {
patch: verParts[2]
};
/**
* Creates processor functions for license banners.
*
* @private
* @param {Object} data Custom data overriding `bannerCommonData`. Will
* not be mutated.
* @return {Function} A function which returns a processed grunt template
* using an object constructed from `bannerCommonData`
* and the `data` argument.
*/
let createLicenseProcessor = (data) => function () {
return grunt.template.process(license, {
data: _.merge({}, bannerCommonData, data)
});
};
version.majorMinor = `${version.major}.${version.minor}`;
grunt.vjsVersion = version;
@ -49,6 +67,7 @@ module.exports = function(grunt) {
},
build: {
files: {
'build/temp/alt/video.novtt.min.js': 'build/temp/alt/video.novtt.js',
'build/temp/video.min.js': 'build/temp/video.js'
}
}
@ -224,7 +243,6 @@ module.exports = function(grunt) {
debug: true,
standalone: 'videojs'
},
banner: license,
plugin: [
['browserify-derequire']
],
@ -294,6 +312,13 @@ module.exports = function(grunt) {
}
},
concat: {
novtt: {
options: {
separator: '\n'
},
src: ['build/temp/video.js'],
dest: 'build/temp/video.novtt.js'
},
vtt: {
options: {
separator: '\n',
@ -318,6 +343,24 @@ module.exports = function(grunt) {
'watch',
'browserify:watch'
]
},
usebanner: {
novtt: {
options: {
process: createLicenseProcessor({includesVtt: false})
},
files: {
src: ['build/temp/alt/video.novtt.js']
}
},
vtt: {
options: {
process: createLicenseProcessor({includesVtt: true})
},
files: {
src: ['build/temp/video.js']
}
}
}
});
@ -332,8 +375,11 @@ module.exports = function(grunt) {
'jshint',
'browserify:build',
'exorcise:build',
'copy:novtt',
'concat:novtt',
'concat:vtt',
'copy:novtt',
'usebanner:novtt',
'usebanner:vtt',
'uglify',
'sass',

View File

@ -44,7 +44,7 @@
"es5-shim": "^4.1.3",
"grunt": "^0.4.4",
"grunt-aws-s3": "^0.12.1",
"grunt-banner": "^0.3.1",
"grunt-banner": "^0.4.0",
"grunt-browserify": "3.5.1",
"grunt-cli": "~0.1.0",
"grunt-concurrent": "^1.0.0",