-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
49 lines (42 loc) · 1.29 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
/* global require, exports */
const gulp = require('gulp');
const uglify = require('gulp-uglify');
const cleanCSS = require('gulp-clean-css');
const gulpFilter = require('gulp-filter');
const eslint = require('gulp-eslint');
const stylelint = require('gulp-stylelint');
const lintPathsJS = [
'skel/static/js/*.js',
'gulpfile.js'
];
const lintPathsCSS = [
'skel/static/css/*.css'
];
function lint_js() {
return gulp.src(lintPathsJS)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
}
function lint_css() {
return gulp.src(lintPathsCSS)
.pipe(stylelint({
reporters: [{ formatter: 'string', console: true}]
}));
}
function assets() {
var filterJS = gulpFilter('**/*.js', { restore: true });
var filterCSS = gulpFilter('**/*.css', { restore: true });
var p = require('./package.json');
var assets = p.assets;
return gulp.src(assets, {cwd : 'node_modules/**'})
.pipe(filterJS)
.pipe(uglify())
.pipe(filterJS.restore)
.pipe(filterCSS)
.pipe(cleanCSS({rebase: false}))
.pipe(filterCSS.restore)
.pipe(gulp.dest('monopati/skel/static/lib'));
}
exports.test = gulp.parallel(lint_css, lint_js);
exports.default = gulp.series(lint_css, lint_js, assets);