-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
68 lines (56 loc) · 1.71 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
var gulp = require('gulp');
var jade = require('gulp-jade');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('gulp-autoprefixer');
var del = require('del');
var runsequence = require('run-sequence');
gulp.task('jade', function () {
return gulp.src('src/templates/pages/*.jade')
.pipe(jade())
.pipe(gulp.dest('build'));
});
var sassOptions = {
errLogToConsole: true,
outputStyle: 'exapnded'
};
var autoprefixerOptions = {
browsers: ['last 2 versions', '> 5%', 'Firefox ESR']
};
gulp.task('sass', function () {
return gulp.src('src/scss/pages/*.scss')
.pipe(sourcemaps.init())
.pipe(sass(sassOptions).on('error', sass.logError))
.pipe(sourcemaps.write('./'))
// .pipe(autoprefixer())
.pipe(gulp.dest('build/css'));
});
gulp.task('assets', function () {
return gulp.src('src/vendor/**/*')
.pipe(gulp.dest('build/vendor'));
});
gulp.task('scripts', function () {
return gulp.src('src/scripts/**/*.js')
.pipe(gulp.dest('build/js'));
});
gulp.task('images', function () {
return gulp.src('src/images/**/*')
.pipe(gulp.dest('build/img'));
});
gulp.task('build', ['jade', 'sass', 'scripts', 'images', 'assets']);
gulp.task('clean', function () {
return del([
'build'
]);
});
// default task
gulp.task('default', function () {
runsequence('clean', 'build');
});
// watch
gulp.task('watch', function () {
return gulp.watch(['src/scripts/**/*.js', 'src/scss/**/*.scss', 'src/templates/**/*.jade'], ['build'])
.on('change', function(event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
});
});