forked from Cleasto/code-school-manifesto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
73 lines (63 loc) · 1.92 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
// Special thanks to @chriskjaer for the handy little
// gulpfile.json and package.json that this was based off of:
// https://gist.github.com/chriskjaer/8634047
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'),
livereload = require('gulp-livereload'),
tinylr = require('tiny-lr'),
express = require('express'),
app = express(),
marked = require('marked'),
path = require('path'),
server = tinylr(),
deploy = require("gulp-gh-pages");
gulp.task('css', function() {
return gulp.src('css/main.scss')
.pipe(
sass({
includePaths: ['css'],
errLogToConsole: true
}))
.pipe(csso())
.pipe(gulp.dest('dist/css/'))
.pipe(livereload(server));
});
gulp.task('js-copy', function() {
return gulp.src('js/*.js')
.pipe(gulp.dest('dist/js/'))
.pipe(livereload(server));
});
gulp.task('templates', function() {
return gulp.src('templates/*.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('css/*.*', ['css']);
gulp.watch('js/*.js', ['js-copy']);
gulp.watch(['templates/*.jade', 'README.md'], ['templates']);
});
});
gulp.task('deploy', function() {
gulp.src("dist/**/*")
.pipe(deploy('[email protected]:masondesu/code-school-manifesto.git', 'origin'));
});
// Default Task
gulp.task('default', ['js-copy', 'css', 'templates', 'express', 'watch']);