-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
43 lines (40 loc) · 1.14 KB
/
Copy pathgulpfile.js
File metadata and controls
43 lines (40 loc) · 1.14 KB
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
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var pug = require('gulp-pug');
var stylus = require('gulp-stylus');
var autoprefixer = require('gulp-autoprefixer');
var image = require('gulp-image');
gulp.task('serve', ['stylus', 'html'], function() {
browserSync.init({
server: "./"
});
gulp.watch("stylus/**/*.styl", ['stylus']);
gulp.watch("pug/**/*.pug", ['html']);
gulp.watch("app/*.js").on('change', browserSync.reload);
});
gulp.task('html', function buildHTML() {
return gulp.src('pug/*.pug')
.pipe(pug({
pretty: true
}))
.pipe(gulp.dest('./'))
.pipe(browserSync.stream());
});
gulp.task('stylus', function(){
return gulp.src('stylus/*.styl')
.pipe(stylus({
compress: true
}))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('./css'))
.pipe(browserSync.stream());
});
gulp.task('image', function () {
gulp.src('./images/*')
.pipe(image())
.pipe(gulp.dest('./images'));
});
gulp.task('default', ['serve']);