-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
93 lines (79 loc) · 1.72 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
83
84
85
86
87
88
89
90
91
92
93
'use strict';
const gulp = require('gulp');
const plumber = require('gulp-plumber');
const dist = './dist';
/*
* SASS
*/
const sass = require('gulp-sass');
gulp.task('sass', function () {
return gulp.src(['./assets/styles/**/*.sass'])
.pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError))
.pipe(gulp.dest(dist));
});
/*
* JS
*/
const babel = require('gulp-babel');
gulp.task('js', function () {
gulp.src(['./assets/scripts/**/*', '!./assets/scripts/main.js'])
.pipe(gulp.dest(dist));
gulp.src(['./assets/scripts/main.js'])
.pipe(plumber())
.pipe(babel({
presets: ['env']
}))
.pipe(gulp.dest(dist));
});
/*
* Images
*/
gulp.task('images', function () {
return gulp.src(['./assets/images/**/*'])
.pipe(gulp.dest(dist + '/images'));
});
/*
* Sounds
*/
gulp.task('sounds', function () {
return gulp.src(['./assets/sounds/**/*'])
.pipe(gulp.dest(dist + '/sounds'));
});
/*
* HTML
*/
gulp.task('html', function () {
return gulp.src(['./*.html'])
.pipe(gulp.dest(dist));
});
/*
* Server
*/
const webserver = require('gulp-webserver');
gulp.task('webserver', function() {
return gulp.src('./')
.pipe(webserver({
livereload: false,
directoryListing: true,
open: true,
}));
});
/*
* Deploy
*/
const ghPages = require('gulp-gh-pages');
gulp.task('deploy', function() {
return gulp.src('./dist/**/*')
.pipe(ghPages());
});
/*
* default
*
* uma familia muito unida, mas também muito ouriçada...
*/
gulp.task('default', ['sass', 'js', 'images', 'html', 'sounds', 'webserver'], function () {
gulp.watch(['./assets/styles/**/*'], ['sass']);
gulp.watch(['./assets/scripts/**/*'], ['js']);
gulp.watch(['./assets/images/**/*'], ['images']);
gulp.watch(['./*.html'], ['html']);
});