-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
87 lines (75 loc) · 2.28 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
var gulp = require('gulp'),
gutil = require('gulp-util'),
sass = require('gulp-sass'),
csso = require('gulp-csso'),
uglify = require('gulp-uglify'),
jade = require('gulp-jade'),
concat = require('gulp-concat'),
autoprefixer = require('gulp-autoprefixer'),
rename = require('gulp-rename'),
livereload = require('gulp-livereload'),
tinylr = require('tiny-lr'),
express = require('express'),
app = express(),
marked = require('marked'), // For :markdown filter in jade
path = require('path'),
server = tinylr();
// --- Basic Tasks ---
gulp.task('vendor', function() {
return gulp.src('source/vendor/stylesheets/*.css')
.pipe( concat('vendor.css') )
.pipe( gulp.dest('dist/stylesheets/') )
});
gulp.task('scss', function() {
return gulp.src('source/stylesheets/**/*.scss')
.pipe(
sass( {
includePaths: ['source/stylesheets'],
errLogToConsole: true
} ) )
.pipe( autoprefixer('last 2 versions') )
.pipe( gulp.dest('dist/') )
});
gulp.task('css', ['vendor', 'scss'], function() {
return gulp.src(
[
'dist/vendor.css',
'dist/base.css'
],
{ base: 'dist/' }
)
.pipe( csso() )
.pipe( concat('application.min.css') )
.pipe( gulp.dest('dist/') )
});
gulp.task('js', function() {
return gulp.src('source/javascripts/*.js')
// .pipe( uglify().on('error', gutil.log) )
.pipe( concat('application.js') )
.pipe( gulp.dest('dist/') )
});
gulp.task('templates', function() {
return gulp.src('source/**/*.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('watch', function () {
server.listen(35729, function (err) {
if (err) {
return console.log(err);
}
gulp.watch('source/stylesheets/**/*.scss', ['css']);
gulp.watch('source/javascripts/*.js', ['js']);
// gulp.watch('source/**/*.jade', ['templates']);
});
});
// Default Task
gulp.task('default', ['js', 'css', 'express', 'watch']);