-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
62 lines (56 loc) · 1.76 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var tap = require('gulp-tap');
const path = require('path');
var fs = require('fs');
var jade = require('gulp-jade');
var concat = require('gulp-concat');
var minify = require('gulp-minify');
var autoprefixer = require('gulp-autoprefixer');
var cleancss = require('gulp-clean-css');
gulp.task('css', function(){
gulp.src(['./in/sass/*.scss',"./in/static/css/*"]).pipe(sass().on('error', sass.logError))
.pipe(concat('style.css'))
.pipe(autoprefixer())
.pipe(minify())
.pipe(cleancss())
.pipe(gulp.dest('./out/static/css'))
.pipe(tap(function(file, t) {
console.log("+ css");
}));
});
gulp.task('static', function(){
gulp.src(["./in/static/fonts/*"]).pipe(gulp.dest('./out/static/fonts'));
gulp.src(["./in/static/img/*"]).pipe(gulp.dest('./out/static/img'));
console.log("+ static");
});
gulp.task('jade', function() {
gulp.src('./in/pages/*.jade')
.pipe(jade({
client: false
}))
.pipe(tap(function(file, t) {
console.log("+ " + path.basename(file.path));
}))
.pipe(gulp.dest('./out/'));
});
gulp.task('js', function() {
gulp.src('./in/static/js/*.js')
.pipe(concat('bundle.js'))
.pipe(gulp.dest('./out/static/js'));
});
gulp.task('watch', function() {
console.log("- watching");
gulp.watch('./in/sass/*.scss', ['css']);
gulp.watch('./in/pages/*.jade', ['jade']);
gulp.watch('./in/layouts/*.jade', ['jade']);
gulp.watch('./in/js/*.js', ['js']);
});
gulp.task('serve', function() {
var spawn = require('child_process').spawn;
gulp.task('serve', function() {
spawn('node', ['./serve.js'], { stdio: 'inherit' });
});
});
gulp.task('build', [ 'css', 'js', 'jade', 'static' ]);
gulp.task('dev', [ 'build', 'watch', 'serve' ]);