sp-codes.de/bower_components/what-input/gulpfile.js/tasks/scripts.js
2016-10-28 19:33:25 +02:00

36 lines
1.2 KiB
JavaScript

var gulp = require('gulp');
var plumber = require('gulp-plumber');
var notify = require('gulp-notify');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var header = require('gulp-header');
var pkg = require('../../package.json');
var banner = ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
''].join('\n');
gulp.task('scripts-uglify', function() {
return gulp.src(['./what-input.js'])
.pipe(plumber({errorHandler: notify.onError("Error: <%= error.message %>")}))
.pipe(uglify())
.pipe(rename('what-input.min.js'))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest('./'))
.pipe(notify('Scripts uglify task complete'));
});
gulp.task('scripts-ie8', function() {
return gulp.src(['./polyfills/ie8/*.js'])
.pipe(plumber({errorHandler: notify.onError("Error: <%= error.message %>")}))
.pipe(concat('lte-IE8.js'))
.pipe(uglify())
.pipe(gulp.dest('./'))
.pipe(notify('IE8 scripts task complete'));
});
gulp.task('scripts', ['scripts-uglify', 'scripts-ie8']);