-
Notifications
You must be signed in to change notification settings - Fork 10
/
gulpfile.js
70 lines (64 loc) · 1.68 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
const gulp = require('gulp');
const connect = require('gulp-connect');
const open = require('open');
const jscs = require('gulp-jscs');
const jshint = require('gulp-jshint');
const stylish = require('gulp-jscs-stylish');
const gulpJsdoc2md = require('gulp-jsdoc-to-markdown')
const rename = require('gulp-rename');
const concat = require('gulp-concat');
const gutil = require('gulp-util');
const uglify = require('gulp-uglify');
const fs = require('fs');
/**
* Run Connect Server.
*/
gulp.task('connect', function () {
connect.server({
root: ""
});
});
/**
* Open examples in the browser.
*/
gulp.task('examples', function () {
open('http://localhost:8080/examples/horizontal.html');
open('http://localhost:8080/examples/vertical.html');
});
/**
* Validate source code using jscs and jshint.
*/
gulp.task('checkcode', function () {
gulp.src('.')
.pipe(jshint())
.pipe(jscs())
.on('error', function () { })
.pipe(stylish.combineWithHintResults())
.pipe(jshint.reporter('jshint-stylish'));
});
/**
* Create documentation in markdown format.
*/
gulp.task('docs', function () {
return gulp.src('sliderTV.js')
.pipe(gulpJsdoc2md())
.on('error', function (err) {
gutil.log(gutil.colors.red('jsdoc2md failed'), err.message)
})
.pipe(rename(function (path) {
path.extname = '.md'
}))
.pipe(gulp.dest('docs'))
});
/**
* Minify code.
*/
gulp.task('compress', function () {
return gulp.src('sliderTV.js')
.pipe(uglify({ output: { comments: /^!/i } }))
.pipe(gulp.dest('dist'));
});
/**
* Default action.
*/
gulp.task('default', ['compress', 'docs'], function () { });