forked from phodal/booktree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·64 lines (54 loc) · 1.55 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
/* jshint node:true */
'use strict';
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var mocha = require('gulp-mocha');
gulp.task('contact', function () {
var jsonConcat = require("json-concat");
jsonConcat({
src: ["data/0.json", "data/1-html.json"],
dest: "./data/data.json"
}, function (json) {
console.log(json);
});
});
gulp.task('jshint', function () {
return gulp.src('app/scripts/**/*.js')
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.jshint.reporter('fail'));
});
gulp.task('connect', function () {
var serveStatic = require('serve-static');
var serveIndex = require('serve-index');
var app = require('connect')()
.use(require('connect-livereload')({port: 35729}))
.use(serveStatic('./'))
.use(serveIndex('./'));
require('http').createServer(app)
.listen(9000)
.on('listening', function () {
console.log('Started connect web server on http://localhost:9000');
});
});
gulp.task('serve', ['connect', 'watch'], function () {
require('opn')('http://localhost:9000');
});
gulp.task('watch', ['connect'], function () {
$.livereload.listen();
gulp.watch([
'index.html',
'app/scripts/**.js',
'app/images/**/*',
'app/styles/**/*.css',
'app/templates/**.html',
'app/logo/**/*',
'data/**.json'
]).on('change', $.livereload.changed);
});
gulp.task('build', ['jshint'], function () {
return gulp.src('dist/**/*').pipe($.size({title: 'build', gzip: true}));
});
gulp.task('default', function () {
gulp.start('build');
});