-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
59 lines (49 loc) · 1.33 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var connect = require('gulp-connect');
var git = require('gulp-git');
var deploy = require('gulp-gh-pages');
gulp.task('sass', function() {
gulp.src('demo.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(''))
.pipe(connect.reload());
});
gulp.task('html', function() {
gulp.src('index.html')
.pipe(connect.reload());
});
gulp.task('server', function() {
connect.server({
port: 3000,
livereload: true
});
});
gulp.task('watch', function() {
gulp.watch('sass/**/*.scss', ['sass']);
gulp.watch('demo.scss', ['sass']);
gulp.watch('index.html', ['html']);
});
gulp.task('tag', function(done) {
var pkg = JSON.parse(require('fs').readFileSync('./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();
});
});
});
gulp.task('npm', function(done) {
require('child_process')
.spawn('npm', ['publish'], { stdio: 'inherit' })
.on('close', done);
});
gulp.task('deploy', ['sass'], function() {
return gulp.src(['index.html', 'demo.css'])
.pipe(deploy());
});
gulp.task('default', ['server', 'sass', 'watch']);
gulp.task('release', ['tag', 'npm', 'deploy']);