-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
58 lines (50 loc) · 1.38 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
var path = require('path');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var webserver = require('gulp-webserver');
var browserify = require('browserify');
var sass = require('gulp-sass');
var jade = require("gulp-jade");
gulp.task('javascripts', function() {
var bundler = browserify({
entries: ['./javascripts/app.js'],
});
bundler
.bundle()
.pipe(source('app.js'))
.pipe(gulp.dest('public/javascripts/'));
});
gulp.task('images', function() {
gulp.src("images/*")
.pipe(gulp.dest("public/images"));
});
gulp.task('jade', function() {
gulp.src("views/*.jade", {base: './views'})
.pipe(jade())
.pipe(gulp.dest("public"));
});
gulp.task('sass', function() {
gulp.src('stylesheets/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('public/stylesheets'));
});
gulp.task('build', ['javascripts', 'images', 'jade', 'sass']);
gulp.task('serve', function() {
setTimeout(function() {
gulp.src('public')
.pipe(webserver({
livereload: false,
directoryListing: false,
open: true,
middleware: function(req, res, next) {
var basename = path.basename(req.url);
var extname = path.extname(req.url);
if (basename && basename !== "/" && !extname) {
// like the github page
req.url += ".html";
}
next();
},
}));
}, 1000);
});