-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgulpfile.babel.js
45 lines (38 loc) · 1.05 KB
/
gulpfile.babel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* eslint-disable import/no-extraneous-dependencies */
import gulp from 'gulp';
import babel from 'gulp-babel';
import browserify from 'gulp-browserify';
import { exec } from 'child_process';
import rename from 'gulp-rename';
import uglify from 'gulp-uglify';
const files = {
rawJS: ['./src/**/*.js'],
};
gulp.task('transpile', ['css'], () =>
gulp.src(files.rawJS)
.pipe(babel())
.pipe(gulp.dest('./build'))
);
gulp.task('browserify', ['transpile'], () =>
gulp.src('./build/main.js')
.pipe(browserify({
standalone: 'GMusicMiniPlayer',
transform: ['brfs']
}))
.pipe(rename('gmusic-mini-player.js'))
.pipe(gulp.dest('./dist'))
);
gulp.task('uglify', ['browserify'], () =>
gulp.src('./dist/gmusic-mini-player.js')
.pipe(uglify())
.pipe(rename('gmusic-mini-player.min.js'))
.pipe(gulp.dest('./dist'))
);
gulp.task('css', function (cb) {
exec('node lib/generate-stylesheet.js', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
})
gulp.task('build', ['uglify']);