Add gulpfile.js
Showing
1 changed file
with
24 additions
and
0 deletions
gulpfile.js
0 → 100644
1 | const srcPath = './lib/relative-placement.js'; | ||
2 | const distPath = './dist/'; | ||
3 | var gulp = require('gulp'); | ||
4 | var babel = require('gulp-babel'); | ||
5 | var replace = require('gulp-replace'); | ||
6 | var rename = require('gulp-rename'); | ||
7 | var del = require('del'); | ||
8 | var package = require('./package.json'); | ||
9 | gulp.task('default', ['build']); | ||
10 | gulp.task('build',['clean'], ()=>{ | ||
11 | return gulp.src(srcPath) | ||
12 | .pipe(replace(/RelativePlacement.version = '.+?';/, 'RelativePlacement.version = \''+package.version+'\';')) | ||
13 | .pipe(gulp.dest(distPath)) | ||
14 | .pipe(babel({ | ||
15 | presets: ['es2015'] | ||
16 | })) | ||
17 | .pipe(rename(path => { | ||
18 | path.basename += '-es2015' | ||
19 | })) | ||
20 | .pipe(gulp.dest(distPath)); | ||
21 | }); | ||
22 | gulp.task('clean',() => { | ||
23 | return del(distPath); | ||
24 | }); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment