-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
43 lines (36 loc) · 1.26 KB
/
gulpfile.js
File metadata and controls
43 lines (36 loc) · 1.26 KB
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
const gulp = require('gulp');
const pug = require('gulp-pug');
const stylus = require('gulp-stylus');
const connect = require('gulp-connect');
const imagemin = require('gulp-imagemin');
const data = require('gulp-data');
gulp.task('pug', () => {
gulp.src('./src/*.pug')
.pipe(data(() => require('./projects.json')))
.pipe(pug())
.pipe(gulp.dest('./out'))
.pipe(connect.reload())
})
gulp.task('stylus', () => {
gulp.src('./src/assets/styles/*.styl')
.pipe(stylus())
.pipe(gulp.dest('./out/assets/styles/'))
.pipe(connect.reload())
})
gulp.task('imagemin', () => {
gulp.src('src/assets/img/*')
.pipe(imagemin())
.pipe(gulp.dest('out/assets/img'))
})
gulp.task('watch', () => {
gulp.watch(['./src/*.pug', './src/partials/*.pug', './src/layouts/*.pug'], ['pug'])
gulp.watch(['./src/assets/styles/*.styl', './src/assets/styles/modules/*.styl'], ['stylus'])
})
gulp.task('serve', () => {
connect.server({
root: './out',
livereload: true
})
})
gulp.task('build', ['pug', 'stylus', 'imagemin'])
gulp.task('server', ['serve', 'watch'])