forked from robinparisi/tingle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
91 lines (77 loc) · 1.93 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
/* eslint-env node */
var gulp = require('gulp')
var browserSync = require('browser-sync')
var autoprefixer = require('gulp-autoprefixer')
var uglify = require('gulp-uglify')
var ghPages = require('gulp-gh-pages')
var rename = require('gulp-rename')
var reload = browserSync.reload
var cleanCSS = require('gulp-clean-css')
/* config
---------------------------------------------------- */
/**
* CSS build
*/
gulp.task('css', function () {
return gulp.src('src/tingle.css')
.pipe(autoprefixer({
browsers: ['> 1%', 'last 3 versions'],
cascade: false
}))
.pipe(gulp.dest('dist'))
.pipe(reload({stream:true}))
})
/**
* CSS build + min
*/
gulp.task('css-min', function () {
return gulp.src('src/tingle.css')
.pipe(autoprefixer({
browsers: ['> 1%', 'last 3 versions'],
cascade: false
}))
.pipe(cleanCSS())
.pipe(rename('tingle.min.css'))
.pipe(gulp.dest('dist'))
.pipe(reload({stream:true}))
})
/**
* JS build
*/
gulp.task('js', function() {
return gulp.src('src/tingle.js')
.pipe(gulp.dest('dist'))
})
/**
* JS build + min
*/
gulp.task('js-min', function() {
return gulp.src('src/tingle.js')
.pipe(uglify({
mangle: true
}))
.pipe(rename('tingle.min.js'))
.pipe(gulp.dest('dist'))
})
/**
* Deploy documentation to Github
*/
gulp.task('deploy', function() {
return gulp.src('./doc/**/*')
.pipe(ghPages())
})
/**
* Copy sources to doc folder
*/
gulp.task('copy', ['css', 'css-min', 'js', 'js-min'], function () {
return gulp.src(['dist/**/*'])
.pipe(gulp.dest('doc/tingle'))
})
gulp.task('serve', function() {
browserSync.init({
server: './doc'
})
gulp.watch('src/**', ['copy'])
})
gulp.task('doc', ['copy', 'deploy'])
gulp.task('default', ['css', 'css-min', 'js', 'js-min'])