gulpfile.js 786 Bytes
const srcPath   = './lib/relative-placement.js';
const distPath  = './dist/';
var gulp    = require('gulp');
var babel   = require('gulp-babel');
var replace = require('gulp-replace');
var rename  = require('gulp-rename');
var del     = require('del');
var package = require('./package.json');
gulp.task('default', ['build']);
gulp.task('build',['clean'], ()=>{
    return gulp.src(srcPath)
        .pipe(replace(/RelativePlacement.version = '.+?';/, 'RelativePlacement.version = \''+package.version+'\';'))
        .pipe(gulp.dest(distPath))
        .pipe(babel({
            presets: ['es2015']
        }))
        .pipe(rename(path => {
            path.basename += '-es2015'
        }))
        .pipe(gulp.dest(distPath));
});
gulp.task('clean',() => {
    return del(distPath);
});