1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-19 10:54:16 +02:00
video.js/build/tasks/dist-cdn.js

26 lines
810 B
JavaScript

var uglify = require('uglify-js');
module.exports = function(grunt) {
grunt.registerTask('dist-cdn', 'Assembling distribution', function(){
let css;
let jsmin;
let jsdev;
let cdnjs;
// Replace font urls with CDN versions
css = grunt.file.read('dist/cdn/video-js.css');
css = css.replace(/font\//g, '../f/3/');
grunt.file.write('dist/cdn/video-js.css', css);
// GA Tracking Pixel (manually building the pixel URL)
cdnjs = '\n' + uglify.minify('build/cdn.js').code.replace('v0.0.0', 'v' + grunt.vjsVersion.full);
// Add CDN-specfic JS
js = grunt.file.read('dist/cdn/video.js');
grunt.file.write('dist/cdn/video.js', js + cdnjs);
jsmin = grunt.file.read('dist/cdn/video.min.js');
grunt.file.write('dist/cdn/video.min.js', jsmin + cdnjs);
});
}