mirror of
https://github.com/Fechin/reference.git
synced 2026-11-30 00:51:14 +03:00
fix: format complex changes
Formats all the general js files. Separate in case these should be treated differently for any reason. This commit includes all javascript and HTML files.
This commit is contained in:
15 files changed
+1123
-1115
No files matched your search
+37
-30
@@ -1,37 +1,44 @@
|
||||
const gulp = require('gulp');
|
||||
const htmlmin = require('gulp-htmlmin');
|
||||
const htmlclean = require('gulp-htmlclean');
|
||||
const version = require('gulp-version-number');
|
||||
const terser = require('gulp-terser');
|
||||
const gulp = require("gulp");
|
||||
const htmlmin = require("gulp-htmlmin");
|
||||
const htmlclean = require("gulp-htmlclean");
|
||||
const version = require("gulp-version-number");
|
||||
const terser = require("gulp-terser");
|
||||
|
||||
// Compress js files
|
||||
gulp.task('js', function () {
|
||||
return gulp.src(['./public/js/main.js'])
|
||||
.pipe(terser({
|
||||
compress: true
|
||||
}))
|
||||
.pipe(gulp.dest('./public/js'));
|
||||
gulp.task("js", function () {
|
||||
return gulp
|
||||
.src(["./public/js/main.js"])
|
||||
.pipe(
|
||||
terser({
|
||||
compress: true,
|
||||
}),
|
||||
)
|
||||
.pipe(gulp.dest("./public/js"));
|
||||
});
|
||||
|
||||
|
||||
// Build html files
|
||||
gulp.task('html', function () {
|
||||
return gulp.src('./public/**/*.html')
|
||||
.pipe(htmlclean())
|
||||
.pipe(htmlmin({
|
||||
removeComments: true,
|
||||
minifyJS: true,
|
||||
minifyCSS: true,
|
||||
minifyURLs: true,
|
||||
}))
|
||||
.pipe(version({
|
||||
'append': {
|
||||
'key': '_v',
|
||||
'cover': 1,
|
||||
'to': ['css', 'js', 'png', 'jpg', 'woff2']
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('./public'));
|
||||
gulp.task("html", function () {
|
||||
return gulp
|
||||
.src("./public/**/*.html")
|
||||
.pipe(htmlclean())
|
||||
.pipe(
|
||||
htmlmin({
|
||||
removeComments: true,
|
||||
minifyJS: true,
|
||||
minifyCSS: true,
|
||||
minifyURLs: true,
|
||||
}),
|
||||
)
|
||||
.pipe(
|
||||
version({
|
||||
append: {
|
||||
key: "_v",
|
||||
cover: 1,
|
||||
to: ["css", "js", "png", "jpg", "woff2"],
|
||||
},
|
||||
}),
|
||||
)
|
||||
.pipe(gulp.dest("./public"));
|
||||
});
|
||||
|
||||
gulp.task('default', gulp.parallel('js', 'html'));
|
||||
gulp.task("default", gulp.parallel("js", "html"));
|
||||
Reference in new issue
Block a user