-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
66 lines (56 loc) · 1.49 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
'use strict';
const gulp = require('gulp');
const del = require('del');
const runSequence = require('run-sequence');
const browserSync = require('browser-sync');
const gulpLoadPlugins = require('gulp-load-plugins');
// load the plugins into an array of plugins
const $ = gulpLoadPlugins();
// configs
const sassOptions = { outputStyle: 'nested' };
const nanoOptions = {
convertValues: { length: false, boolean: false },
mergeRules: false
};
// tasks
gulp.task('styles', () =>
gulp
.src('app/sass/*.scss')
.pipe(
$.sass(sassOptions)
.on('error', $.sass.logError)
)
.pipe($.cssnano(nanoOptions))
.pipe(gulp.dest('dist/css'))
.pipe(browserSync.stream({ match: '**/*.css' }))
);
gulp.task('views', () =>
gulp
.src([
'app/**/*.html',
'!node_modules/**/*.html'
])
.pipe(gulp.dest('dist'))
);
gulp.task('clean', () => del(['dist'], { dot: true }) );
gulp.task('default', ['build'], () => {
browserSync({
notify: false,
server: 'dist',
online: true
});
gulp.watch('app/sass/**/*.scss', ['styles']);
gulp.watch('app/**/*.html', ['views']);
gulp.watch([
'dist/**/*.html',
'dist/css/*.css'
]).on('change', browserSync.reload);
});
gulp.task('build', callback => {
runSequence('clean', 'views', 'styles', callback);
});
gulp.task('deploy', ['build'], () =>
gulp
.src('./dist/**/*')
.pipe($.ghPages())
);