gulp better

This commit is contained in:
Monica Dinculescu
2017-01-11 16:11:33 -08:00
parent cd0a119a71
commit d8b0f4ef9d

View File

@@ -1,6 +1,6 @@
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
@@ -8,11 +8,8 @@
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
// jshint node: true
'use strict';
// Dan things
const gulp = require('gulp');
const sourcemaps = require('gulp-sourcemaps');
const babel = require('gulp-babel');
@@ -36,84 +33,40 @@ const babiliConfig = {
shouldPrintComment: singleLicenseComment()
};
gulp.task('minify-none', () => {
function minify(polyfill) {
return rollup({
entry: './entrypoints/webcomponents-none-index.js',
entry: './entrypoints/' + polyfill + '-index.js',
format: 'iife',
moduleName: 'webcomponentsjs',
sourceMap: true
})
.pipe(source('webcomponents-none-index.js'))
.pipe(source(polyfill +'-index.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// .pipe(babel(babiliConfig))
.pipe(rename('webcomponents-none.min.js'))
.pipe(babel(babiliConfig))
.pipe(rename(polyfill + '.min.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./'))
}
gulp.task('minify-none', () => {
minify('webcomponents-none')
});
gulp.task('minify-hi', () => {
return rollup({
entry: './entrypoints/webcomponents-hi-index.js',
format: 'iife',
moduleName: 'webcomponentsjs',
sourceMap: true
})
.pipe(source('webcomponents-hi-index.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// .pipe(babel(babiliConfig))
.pipe(rename('webcomponents-hi.min.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./'))
minify('webcomponents-hi')
});
gulp.task('minify-hi-ce', () => {
return rollup({
entry: './entrypoints/webcomponents-hi-ce-index.js',
format: 'iife',
moduleName: 'webcomponentsjs',
sourceMap: true
})
.pipe(source('webcomponents-hi-ce-index.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// .pipe(babel(babiliConfig))
.pipe(rename('webcomponents-hi-ce.min.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./'))
minify('webcomponents-hi-ce')
});
gulp.task('minify-hi-ce-sd', () => {
return rollup({
entry: './entrypoints/webcomponents-hi-ce-sd-index.js',
format: 'iife',
moduleName: 'webcomponentsjs',
sourceMap: true
})
.pipe(source('webcomponents-hi-ce-sd-index.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// .pipe(babel(babiliConfig))
.pipe(rename('webcomponents-hi-ce-sd.min.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./'))
minify('webcomponents-hi-ce-sd')
});
gulp.task('minify-hi-ce-sd-pf', () => {
return rollup({
entry: './entrypoints/webcomponents-hi-ce-sd-pf-index.js',
format: 'iife',
moduleName: 'webcomponentsjs',
sourceMap: true
})
.pipe(source('webcomponents-hi-ce-sd-pf-index.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// .pipe(babel(babiliConfig))
.pipe(rename('webcomponents-hi-ce-sd-pf.min.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./'))
minify('webcomponents-hi-ce-sd-pf')
});
gulp.task('default', ['minify-none', 'minify-hi', 'minify-hi-ce', 'minify-hi-ce-sd', 'minify-hi-ce-sd-pf']);