forked from touchstonejs/touchstonejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
120 lines (89 loc) · 1.97 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
var del = require('del'),
gulp = require('gulp'),
bump = require('gulp-bump'),
connect = require('gulp-connect'),
deploy = require("gulp-gh-pages"),
git = require("gulp-git"),
less = require('gulp-less');
/**
* Clean the build
*/
gulp.task('clean', function(done) {
del(['site/public/build'], done);
});
/**
* Build site css from less
*/
function buildSiteCSS() {
return gulp.src('site/src/less/site.less')
.pipe(less())
.pipe(gulp.dest('site/public/build/css'))
.pipe(connect.reload());
}
gulp.task('build:site:css', buildSiteCSS);
/**
* Build site
*/
gulp.task('build:site', [
'build:site:css'
]);
gulp.task('watch:site', [
'build:site:css'
], function() {
gulp.watch(['site/src/less/**/*'], ['build:site:css']);
});
/**
* Serve task for local development
*/
gulp.task('site', ['watch:site'], function() {
connect.server({
root: 'site/public',
port: 8000,
livereload: true
});
});
/**
* Version bump tasks
*/
function _bump(type) {
return function() {
return gulp.src(['./package.json', './bower.json'])
.pipe(bump({ type: type }))
.pipe(gulp.dest('./'));
};
}
gulp.task('bump', _bump('patch'));
gulp.task('bump:minor', _bump('minor'));
gulp.task('bump:major', _bump('major'));
/**
* Git tag task
* (version *must* be bumped first)
*/
gulp.task('publish:tag', function(done) {
var pkg = require('./package.json');
var v = 'v' + pkg.version;
var message = 'Release ' + v;
git.tag(v, message, function (err) {
if (err) throw err;
git.push('origin', v, function (err) {
if (err) throw err;
done();
});
});
});
/**
* npm publish task
* * (version *must* be bumped first)
*/
gulp.task('publish:npm', function(done) {
require('child_process')
.spawn('npm', ['publish'], { stdio: 'inherit' })
.on('close', done);
});
/**
* Deploy tasks
*/
gulp.task('publish:site', ['build:site'], function() {
return gulp.src('site/public/**/*').pipe(deploy());
});
gulp.task('release', ['publish:tag', 'publish:npm', 'publish:site']);