-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
executable file
·79 lines (70 loc) · 1.76 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
const gulp = require('gulp')
const connect = require('gulp-connect')
const plumber = require('gulp-plumber')
const pug = require('gulp-pug')
const stylus = require('gulp-stylus')
const nib = require('nib')
const koutoSwiss = require('kouto-swiss')
const shell = require('gulp-shell')
const standard = require('gulp-standard')
const surge = require('gulp-surge')
const paths = {
html: './src/pug/**/*',
css: './src/stylus/**/*',
js: './src/js/**/*'
}
gulp.task('connect', () => {
connect.server({
root: './docs',
port: 5001,
livereload: true
})
})
gulp.task('standard', () => {
gulp.src(paths.js)
.pipe(standard())
.pipe(standard.reporter('default', {
breakOnError: false,
quiet: true
}))
.pipe(connect.reload())
})
gulp.task('js', () => {
gulp.src('./src/js/*.js', {read: false})
.pipe(plumber())
.pipe(shell([
'./node_modules/parcel-bundler/bin/cli.js build <%= file.path %> --out-dir ./docs/assets/js'
]))
.pipe(connect.reload())
})
gulp.task('stylus', () => {
gulp.src('./src/stylus/*.styl')
.pipe(plumber())
.pipe(stylus({
compress: false,
use: [nib(), koutoSwiss()],
import: ['nib', 'kouto-swiss']
}))
.pipe(gulp.dest('./docs/assets/css'))
.pipe(connect.reload())
})
gulp.task('pug', () => {
gulp.src('./src/pug/*.pug')
.pipe(plumber())
.pipe(pug())
.pipe(gulp.dest('./docs'))
.pipe(connect.reload())
})
gulp.task('deploy', [], () => {
return surge({
project: './docs',
domain: 'eleicoes2018.surge.sh'
})
})
gulp.task('watch', () => {
gulp.watch(paths.css, ['stylus'])
gulp.watch(paths.html, ['pug'])
gulp.watch(paths.js, ['js'])
})
gulp.task('build', ['pug', 'stylus', 'standard', 'js'])
gulp.task('server', ['build', 'connect', 'watch'])