-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,31 @@ | ||
var gulp = require('gulp'); | ||
var minifycss = require('gulp-minify-css'); | ||
var htmlmin = require('gulp-html-minifier-terser'); | ||
var htmlclean = require('gulp-htmlclean'); | ||
var terser = require('gulp-terser'); | ||
const gulp = require('gulp'); | ||
const cleanCSS = require('gulp-clean-css'); | ||
const htmlmin = require('gulp-htmlmin'); | ||
const terser = require('gulp-terser'); | ||
|
||
// 压缩css文件 | ||
const minify_css = () => ( | ||
gulp.src(['./public/**/*.css']) | ||
.pipe(minifycss()) | ||
.pipe(gulp.dest('./public')) | ||
); | ||
|
||
// 压缩html文件 | ||
const minify_html = () => ( | ||
gulp.src(['./public/**/*.html','!./public/{lib,lib/**}']) | ||
.pipe(htmlclean()) | ||
gulp.task('minify_css', () => { | ||
return gulp.src('./public/**/*.css') | ||
.pipe(cleanCSS({level: '2'})) | ||
.pipe(gulp.dest('./public')); | ||
}); | ||
gulp.task('minify_html', function() { | ||
return gulp.src(['./public/**/*.html', '!./public/{lib,lib/**}']) | ||
.pipe(htmlmin({ | ||
collapseWhitespace: true, | ||
removeComments: true, | ||
minifyJS: true, | ||
minifyCSS: true, | ||
minifyURLs: true, | ||
})) | ||
.pipe(gulp.dest('./public')) | ||
) | ||
.pipe(gulp.dest('./public')); | ||
}); | ||
|
||
// 压缩js文件 | ||
const minify_js = () => ( | ||
gulp.src(['./public/**/*.js', '!./public/**/*.min.js','!./public/{lib,lib/**}']) | ||
gulp.task('minify_js', function() { | ||
return gulp.src(['./public/**/*.js', '!./public/**/*.min.js', '!./public/{lib,lib/**}']) | ||
.pipe(terser()) | ||
.pipe(gulp.dest('./public')) | ||
) | ||
.pipe(gulp.dest('./public')); | ||
}); | ||
|
||
module.exports = { | ||
minify_html: minify_html, | ||
minify_css: minify_css, | ||
minify_js: minify_js | ||
}; | ||
gulp.task('one', gulp.parallel( | ||
minify_html, | ||
minify_css, | ||
minify_js | ||
)) | ||
|
||
gulp.task('default', gulp.series('one')); | ||
gulp.task('one', gulp.parallel('minify_html', 'minify_css', 'minify_js')); | ||
gulp.task('default', gulp.series('one')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0556479
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
sciadv – ./
sg.vercel.app
steinsgate.vercel.app
sciadv.vercel.app
sciadv-mcseekeris-projects.vercel.app
sciadv-git-main-mcseekeris-projects.vercel.app
sciadv.mcseekeri.top