-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
74 lines (67 loc) · 1.87 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
65
66
67
68
69
70
71
72
73
74
'use strict';
const gulp = require('gulp');
const plumber = require("gulp-plumber");
const rename = require('gulp-rename');
const autoprefixer = require("gulp-autoprefixer");
const concat = require('gulp-concat');
const uglify = require('gulp-uglify-es').default;
const minifycss = require("gulp-minify-css");
const less = require('gulp-less');
const jeditor = require("gulp-json-editor");
const packageJson = require('./package.json');
function cloneAndMovePackage() {
return gulp.src('./package.json').pipe(jeditor(function(json) {
json.version = packageJson.version + '-next';
return json;
})).pipe(gulp.dest('dist/'));
}
function cloneAndMoveReadme() {
return gulp.src('./README.md').pipe(gulp.dest('dist/'))
.pipe(gulp.dest("./dist"));
}
function css() {
return gulp
.src(["Styles/global/**/*.less"])
.pipe(
plumber({
errorHandler: function(error) {
console.log(error.message);
this.emit("end");
}
})
)
.pipe(less())
.pipe(autoprefixer("last 2 versions"))
.pipe(concat(`main.css`))
.pipe(gulp.dest("dist/"))
.pipe(rename({ suffix: ".min" }))
.pipe(minifycss())
.pipe(gulp.dest("dist/"));
}
function js() {
return gulp
.src("Scripts/app.js")
.pipe(
plumber({
errorHandler: function(error) {
console.log(error.message);
this.emit("end");
}
})
)
.pipe(concat(`main.js`))
.pipe(gulp.dest("dist/"))
.pipe(rename({ suffix: ".min" }))
.pipe(uglify())
.pipe(gulp.dest("dist/"));
}
function ui() {
return gulp.src("UI/**/*.*", { base: "./" }).pipe(gulp.dest("dist/"));
}
const build = gulp.parallel(css, js, ui);
const buildNext = gulp.parallel(css, js, ui, cloneAndMovePackage, cloneAndMoveReadme);
exports.css = css;
exports.js = js;
exports.build = build;
exports.default = build;
exports.buildNext = buildNext;