-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
75 lines (64 loc) · 2.08 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
var gulp = require('gulp'),
gutil = require('gulp-util'),
sass = require('gulp-sass'),
compass = require('gulp-compass'),
minifyCSS = require('gulp-minify-css'),
uglify = require('gulp-uglify'),
jade = require('gulp-jade'),
livereload = require('gulp-livereload'), // Livereload plugin needed: https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei
tinylr = require('tiny-lr'),
express = require('express'),
app = express(),
marked = require('marked'),
path = require('path'),
rename = require('gulp-rename'),
browserify = require('gulp-browserify'),
bowerSrc = require('gulp-bower-src'),
server = tinylr();
gulp.task('compass', function() {
return gulp.src('./src/stylesheets/*.scss')
.pipe(compass({
css: 'dist/stylesheets',
sass: 'src/stylesheets'
}))
.pipe(minifyCSS())
.pipe(gulp.dest('dist/stylesheets'))
.pipe( livereload( server ));
});
gulp.task('js', function() {
return gulp.src('src/scripts/*.js')
.pipe( browserify() )
//.pipe( uglify() )
.pipe( rename('app.js'))
.pipe( gulp.dest('dist/scripts/'))
.pipe( livereload( server ));
});
gulp.task('templates', function() {
return gulp.src('src/*.jade')
.pipe(jade({
pretty: true
}))
.pipe( gulp.dest('dist/') )
.pipe( livereload( server ));
});
gulp.task('express', function() {
app.use(express.static(path.resolve('./dist')));
app.listen(1337);
gutil.log('Listening on port: 1337');
});
gulp.task('bowerSrc', function() {
bowerSrc()
.pipe(gulp.dest('dist/bower_components'));
});
gulp.task('watch', function () {
server.listen(35729, function (err) {
if (err) {
return console.log(err);
}
gulp.watch('src/stylesheets/*.scss',['compass']);
gulp.watch('src/scripts/*.js',['js']);
gulp.watch('src/*.jade',['templates']);
});
});
// Default Task
gulp.task('default', ['js', 'bowerSrc', 'compass','templates','express','watch']);