-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
64 lines (53 loc) · 1.48 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
var browserSync = require('browser-sync').create();
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var nodemon = require('gulp-nodemon');
var pug = require('gulp-pug');
var puglint = require('gulp-pug-lint');
var sass = require('gulp-sass');
var sasslint = require('gulp-sass-lint');
var concat = require('gulp-concat');
var PATHS = {
eslint: "**/*.js",
sass: "src/assets/styles/**/*.sass",
pug: "src/views/*.pug",
bootstrap: "./node_modules/bootstrap/dist/css/bootstrap.css"
};
gulp.task('serve', ['nodemon', 'sass', 'pug'], () => {
browserSync.init({
proxy: 'localhost:4200'
});
gulp.watch(PATHS.sass, ['sass']);
gulp.watch(PATHS.pug, ['pug']);
});
gulp.task('build', ['sass', 'pug']);
gulp.task('pug', function() {
return gulp.src(PATHS.pug)
.pipe(pug())
.pipe(gulp.dest('dist'))
.pipe(browserSync.stream());
});
gulp.task('sass', function() {
return gulp.src([PATHS.sass, PATHS.bootstrap])
.pipe(sass({outputStyle: 'compressed'}))
.pipe(concat('style.css'))
.pipe(gulp.dest('dist'))
.pipe(browserSync.stream());
});
gulp.task('lint', ['lint-pug', 'lint-sass']);
gulp.task('lint-pug', function() {
return gulp.src(PATHS.pug)
.pipe(puglint());
});
gulp.task('lint-sass', function() {
return gulp.src(PATHS.sass)
.pipe(sasslint())
.pipe(sasslint.format())
.pipe(sasslint.failOnError());
});
gulp.task('nodemon', function() {
nodemon({
script: './src/server.js'
});
});
gulp.task('default', ['serve']);