-
Notifications
You must be signed in to change notification settings - Fork 112
/
gulpfile.js
70 lines (61 loc) · 1.72 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
var gulp = require('gulp'),
es6ify = require('es6ify'),
$ = require('gulp-load-plugins')();
gulp.task('js', function () {
gulp.src([
'src/x-gif.js',
'src/x-gif.angular.js',
'src/x-gif.raw.js'
])
.pipe($.plumber())
.pipe($.browserify({
add: [ es6ify.runtime ],
transform: ['es6ify']
}))
.pipe($.uglify())
.pipe(gulp.dest('dist'));
});
gulp.task('html', function () {
gulp.src('src/x-gif.html')
.pipe($.rename('x-gif.local.html'))
.pipe(gulp.dest('dist'));
})
gulp.task('css', function () {
gulp.src('src/x-gif.scss')
.pipe($.rubySass())
.pipe($.autoprefixer("last 2 versions", "> 1%"))
.pipe(gulp.dest('dist'));
})
gulp.task('vulcanize', function () {
gulp.src('dist/x-gif.local.html')
.pipe($.vulcanize({dest: 'dist', inline: true}))
.pipe($.rename('x-gif.html'))
.pipe(gulp.dest('dist'));
})
gulp.task('copy', function () {
gulp.src([
'bower_components/platform/platform.js',
'bower_components/polymer/polymer*',
'bower_components/polymer/layout*',
])
.pipe(gulp.dest('dist'));
});
gulp.task('build', ['js', 'html', 'css', 'copy', 'vulcanize']);
gulp.task('default', ['build', 'connect'], function () {
gulp.watch(['src/*.*js'], ['js']);
gulp.watch(['src/*.html'], ['html']);
gulp.watch(['src/*.scss'], ['css']);
gulp.watch(['bower_components'], ['copy']);
gulp.watch(['dist/x-gif.local.html', 'dist/x-gif.js', 'dist/x-gif.css'], ['vulcanize']);
gulp.watch(['index.html', 'dist/**.*', 'demos/**.*'], function (event) {
return gulp.src(event.path)
.pipe($.connect.reload());
});
});
gulp.task('connect', function () {
$.connect.server({
root: [__dirname],
port: 1983,
livereload: {port: 2983}
})
});