forked from QiShaoXuan/rhythm-ripple
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
37 lines (33 loc) · 1.04 KB
/
gulpfile.js
File metadata and controls
37 lines (33 loc) · 1.04 KB
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
const gulp = require('gulp')
const browserify = require("browserify")
const source = require('vinyl-source-stream')
const babelify = require("babelify")
const browserSync = require("browser-sync").create()
// rhythm 节奏动画
// ripple 正常动画
const buildWhat = process.argv[4]
gulp.task('scripts', function () {
return browserify({
entries: buildWhat === 'rhythm' ? './src/rhythmRipple.js' : './src/ripple.js',
insertGlobals: true,
standalone: 'umd'
})
.transform(babelify, {
presets: ["es2015"]
})
.bundle()
.pipe(source(buildWhat === 'rhythm' ? 'rhythmRipple.js' : 'ripple.js'))
.pipe(gulp.dest('dist'))
.pipe(browserSync.reload({stream: true}))
})
gulp.task('default', ['scripts'], function () {
browserSync.init({
port: (new Date).getFullYear(),
open: false,
server: {
baseDir: ['./']
}
})
gulp.watch('src/*.js', ['scripts'])
console.log('click to open page', `http://localhost:${(new Date).getFullYear()}/${buildWhat === 'rhythm' ? 'rhythm.html' : 'index.html'}`)
})