Skip to content

Commit

Permalink
Add minified versions and build process
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdiemmen committed Jun 29, 2017
1 parent af0ae41 commit 7b74d19
Show file tree
Hide file tree
Showing 7 changed files with 1,428 additions and 187 deletions.
1 change: 1 addition & 0 deletions dist/plyr-ads.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/plyr-ads.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions docs/js/plyr-ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// ==========================================================================
// Plyr-Ads
// plyr-ads.js v1.0.9
// plyr-ads.js v1.1.0
// https://github.com/ferdiemmen/plyr-ads
// License: The MIT License (MIT)
// ==========================================================================
Expand Down Expand Up @@ -34,16 +34,15 @@

// Default config
let defaults = {
container: 'plyr-ads',
classes: [],
adTagUrl: '',
skipButton: {
enabled: true,
text: 'Skip ad',
delay: 10
}
};

// Check letiable types.
// Check variable types.
let _is = {
object: function (input) {
return input !== null && typeof (input) === 'object';
Expand Down
60 changes: 56 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
'use strict';

let gulp = require('gulp');
let sass = require('gulp-sass');
let browserSync = require('browser-sync');
const gulp = require('gulp');
const gutil = require('gulp-util');
const babel = require('gulp-babel');
const sass = require('gulp-sass');
const cssnano = require('gulp-cssnano');
const postcss = require('gulp-postcss');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
const browserSync = require('browser-sync');


gulp.task('demo', ['demo:build'], () => {
Expand Down Expand Up @@ -39,4 +45,50 @@ gulp.task('demo:build:js', () => {
return gulp.src('./src/js/plyr-ads.js')
.pipe(gulp.dest('./docs/js'))
.pipe(browserSync.reload({stream: true}));
})
});

gulp.task('build', [
'build:css',
'build:js'
], (done) => {

done();
});


gulp.task('build:css', () => {

return gulp.src('./src/scss/plyr-ads.scss')
.pipe(sass({
outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(postcss([require('autoprefixer'), require('precss')]))
.pipe(cssnano({
zindex: false
}))
.pipe(rename('plyr-ads.min.css'))
.pipe(gulp.dest('./dist'))
});


gulp.task('build:js', () => {

return gulp.src('./src/js/plyr-ads.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(uglify({
preserveComments: false,
mangle: true,
sequences: true,
dead_code: true,
conditionals: true,
booleans: true,
unused: true,
if_return: true,
join_vars: true,
drop_console: true,
})).on('error', gutil.log)
.pipe(rename('plyr-ads.min.js'))
.pipe(gulp.dest('./dist'));
});
Loading

0 comments on commit 7b74d19

Please sign in to comment.