-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
50 lines (42 loc) · 1.38 KB
/
gulpfile.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
46
47
48
49
50
'use strict';
var browserify = require('browserify');
var gulp = require('gulp');
var transform = require('vinyl-transform');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var watch = require('gulp-watch');
var batch = require('gulp-batch');
var connect = require('gulp-connect');
var ghPages = require('gulp-gh-pages');
var getBundleName = function () {
var version = require('./package.json').version;
var name = require('./package.json').name;
return version + '.' + name + '.' + 'min';
};
gulp.task('connect', function () {
connect.server();
});
gulp.task('javascript', function () {
// transform regular node stream to gulp (buffered vinyl) stream
var browserified = transform(function(filename) {
var b = browserify(filename);
return b.bundle();
});
return gulp.src('./components/app.js')
.pipe(browserified)
.pipe(sourcemaps.init({loadMaps: true}))
// Add transformation tasks to the pipeline here.
//.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist/js/'));
});
gulp.task('watch', function () {
gulp.watch(['**/*.js', '**/*.json'], ['javascript']);
});
gulp.task('deploy', ['javascript'], function () {
return gulp.src(['./index.html', './dist/**/*'])
.pipe(ghPages({
force: true
}));
});
gulp.task('default', ['javascript', 'connect', 'watch']);