forked from mono-company/bedrock-mini
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
82 lines (62 loc) · 1.73 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
var gulp = require('gulp');
var jade = require('gulp-jade');
var autoprefixer = require('gulp-autoprefixer');
var rename = require('gulp-rename');
var replace = require('gulp-replace-task');
var sass = require('gulp-sass');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('images', function() {
gulp.src('images/**/*')
.pipe(gulp.dest('./dist/images/'))
});
gulp.task('fonts', function() {
gulp.src('fonts/**/*')
.pipe(gulp.dest('./dist/fonts/'))
});
gulp.task('js', function() {
gulp.src('js/**/*')
.pipe(gulp.dest('./dist/js/'))
});
gulp.task('sass', function() {
gulp.src('scss/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 5 versions'],
cascade: false
}))
.pipe(browserSync.stream())
.pipe(gulp.dest('./dist/css/'))
});
/**
* Important!!
* Separate task for the reaction to `.jade` files
*/
gulp.task('jade-watch', ['templates'], reload);
gulp.task('templates', function() {
var YOUR_LOCALS = {};
gulp.src('./src/*.jade')
.pipe(jade({
locals: YOUR_LOCALS
}))
.pipe(browserSync.stream())
.pipe(gulp.dest('./dist/'))
});
/**
* Serve and watch the scss/jade files for changes
*/
gulp.task('default', ['sass', 'images', 'js', 'fonts', 'templates'], function () {
browserSync({
server: './dist',
notify: false
});
gulp.watch('./images/**/*', ['images']);
gulp.watch('./fonts/**/*', ['fonts']);
gulp.watch('./scss/*.scss', ['sass']);
gulp.watch('./js/*.js', ['js']);
gulp.watch('./src/*.jade', ['jade-watch']);
});
/**
* Build
*/
gulp.task('build', ['sass', 'images', 'js', 'fonts', 'templates']);