-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgulpfile.js
More file actions
46 lines (38 loc) · 936 Bytes
/
gulpfile.js
File metadata and controls
46 lines (38 loc) · 936 Bytes
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
const { parallel, src, series, watch } = require('gulp');
const browserSync = require('browser-sync').create();
const htmlLint = require('gulp-html-linter');
const cssLint = require('gulp-csslint');
// Static server
const serve = () => {
browserSync.init({
server: {
baseDir: "./"
}
});
};
const reload = (cb) => {
browserSync.reload();
cb();
}
// HTML Linting
const html = (cb) => {
src(['**/*.html', '!node_modules/**/*.html' ])
.pipe(htmlLint())
.pipe(htmlLint.format());
cb();
};
// CSS Linting
const css = (cb) => {
src(['**/*.css', '!node_modules/**/*.css' ])
.pipe(cssLint())
.pipe(cssLint.formatter());
cb();
}
exports.css = css;
exports.html = html;
exports.lint = parallel(html, css);
exports.default = () => {
serve();
watch(['**/*.css', '!node_modules/**/*.css' ], series(css, reload));
watch(['**/*.html', '!node_modules/**/*.html' ], series(html, reload));
};