-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
57 lines (47 loc) · 1.28 KB
/
gulpfile.js
File metadata and controls
57 lines (47 loc) · 1.28 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
var gulp = require('gulp'),
log = require('gulp-util').log,
stylus = require('gulp-stylus'),
browserSync = require('browser-sync'),
del = require('del'),
rename = require("gulp-rename")
slim = require("gulp-slim");
gulp.task('slim', function(){
gulp.src('./src/**/*.slim')
.pipe(slim({
pretty: true
}))
.pipe(gulp.dest('./public/'));
});
gulp.task('styles', function() {
gulp.src('./src/**/*.stylus')
.pipe(stylus())
.pipe(rename(function (path) {
path.dirname = path.dirname.replace("stylus", "css");
}))
.pipe(gulp.dest('./public/'))
});
gulp.task('copy-files', function() {
gulp.src('./src/**/*')
.pipe(gulp.dest('./public'))
});
gulp.task('watch', function() {
log('Watching files');
gulp.watch('./src/**/*', ['build']);
});
gulp.task('browserSync', ['build'], function() {
browserSync({
server: {
baseDir: './public'
}
});
});
gulp.task('clean', function() {
console.log('cleaning public dir.....');
return del.sync(['./public/js/*', './public/css/*', './public/stylus/*', './public/*.*']);
});
gulp.task('echo', function() {
console.log('Hi there!');
});
//define cmd line default task
gulp.task('build', ['clean', 'copy-files', 'styles', 'slim']);
gulp.task('default', ['build', 'watch', 'browserSync']);