-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·62 lines (53 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
51
52
53
54
55
56
57
58
59
60
61
62
var gulp = require('gulp');
var connect = require('gulp-connect-multi')();
var replace = require('gulp-replace');
var ghpages = require('gh-pages');
var clean = require('gulp-clean');
var path = require('path');
var copy = function (){
gulp.src([
'bower_components/**/*',
'demo/*',
'src/*',
'index.html'
], {
base: './'
})
.pipe(gulp.dest('./.tmp/'));
}
var build = function (){
gulp.src(['src/*'])
.pipe(replace(/bower_components/g, '..'))
.pipe(gulp.dest('dist/'));
}
var ignore = function (){
gulp.src(['./.tmp/bower_components/x-carousel'])
.pipe(clean());
}
gulp.task('server', connect.server({
root: [__dirname],
port: 8000,
livereload: true
}));
gulp.task('build', ['beforebuild'],function(){
build()
});
gulp.task('beforebuild', function(){
copy()
ignore()
});
gulp.task('deploy', ['beforebuild'], function () {
ghpages.publish(path.join(__dirname, '.tmp/'), {
clone: 'bower_components/x-carousel',
logger: function(message) {
console.log(message);
}
} , function(err) {
console.log("");
if(err.errno == 34){
console.log("Error: You need run 'gulp build' before deploy your custom element in gh-pages.\n");
} else if(typeof err.errno == "undefined"){
console.log("Error: You need add a remote repository before deploy your custom element in gh-pages.\n");
}
}, true);
});