-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (47 loc) · 1.52 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
const gulp = require("gulp")
const sass = require("gulp-sass")
const pug = require("gulp-pug")
const htmlmin = require("gulp-htmlmin")
const notify = require("gulp-notify")
const concat = require("gulp-concat")
const uglify = require("gulp-uglify")
const browserSync = require("browser-sync").create()
const del = require("del")
/* Tasks cached */
gulp.task("cache:css", () =>
del("./dist/app.css"))
gulp.task("cache:js", () =>
del("./dist/app.js"))
gulp.task("sass", ['cache:css'], () => {
gulp.src("./src/scss/style.scss")
.pipe(sass({
outPutStyle: 'compressed'
}))
.on('error', notify.onError({
title: "erro scss",
message: "<%= error.message %>"
}))
.pipe(concat('app.css'))
.pipe(gulp.dest("./dist"))
.pipe(browserSync.stream())
})
gulp.task("js", ['cache:js'], () =>
gulp.src(['./src/js/jquery.min.js',
'./src/js/app.js'])
.pipe(concat('app.js'))
.pipe(gulp.dest('./dist'))
.pipe(browserSync.stream()))
gulp.task('pug', () =>
gulp.src('./src/views/**/*.pug')
.pipe(pug())
.pipe(gulp.dest('./dist'))
.pipe(browserSync.stream()))
gulp.task("server", () => {
browserSync.init({
server: { baseDir: "./dist" }
})
gulp.watch("./src/scss/**/*.scss", ['sass'])
gulp.watch("./src/views/*.pug", ['pug'])
gulp.watch("./src/js/*.js", ['js'])
})
gulp.task("default", ["sass", "js", "pug", "server"])