Skip to content

Commit

Permalink
Merge branch 'trunk'
Browse files Browse the repository at this point in the history
* trunk:
  more optimization for HTML files
  • Loading branch information
xvoland committed May 24, 2021
2 parents dadcecf + ccb1da6 commit 0e01db2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
16 changes: 12 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ let { src, dest } = require("gulp"),
sass = require("gulp-dart-sass"),
minify_inline = require("gulp-minify-inline"),
autoprefixer = require("gulp-autoprefixer"),
htmlmin = require("gulp-htmlmin"),
group_css_media = require("gulp-group-css-media-queries"),
clean_css = require("gulp-clean-css"),
rename = require("gulp-rename"),
Expand Down Expand Up @@ -83,6 +84,14 @@ function html() {
.pipe(filesinclude()) // include templates for gulp
.pipe(minify_inline()) // minifies inline JS and CSS
.pipe(webp_html())
.pipe(htmlmin({
collapseWhitespace: true,
removeComments: true,
removeCommentsFromCDATA: true,
removeEmptyAttributes: true,
removeEmptyElements: true,
collapseBooleanAttributes: true
}))
.pipe(dest(path.build.html))
.pipe(browsersync.stream()) // update live sync
}
Expand Down Expand Up @@ -147,11 +156,10 @@ function images() {
)
.pipe(dest(path.build.img)) // create webp images
.pipe(dest(path.src.img)) // return to other images
.pipe(image_min({
.pipe(imagemin({
progressive: true,
interlaced: true,
svgoPlugins: [{ removeViewBox: true }],
optimizationLevel: 4 // from 0 to 7
svgoPlugins: [{ removeViewBox: false }],
optimizationLevel: 3 // from 0 to 7
})
)
.pipe(dest(path.build.img))
Expand Down
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "Gulp HTML Template",
"name": "w.dottedbuy.com",
"version": "1.0.0",
"description": "Gulp-HTML-Template",
"description": "",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Vitalii Tereshchuk",
"author": "",
"license": "ISC",
"devDependencies": {
"autoprefixer": "^10.2.5",
Expand All @@ -15,11 +15,15 @@
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.1",
"gulp-clean-css": "^4.3.0",
"gulp-concat": "^2.6.1",
"gulp-cssmin": "^0.2.0",
"gulp-dart-sass": "^1.0.2",
"gulp-file-include": "^2.3.0",
"gulp-fonter": "^0.3.0",
"gulp-group-css-media-queries": "^1.2.2",
"gulp-htmlmin": "^5.0.1",
"gulp-imagemin": "^7.1.0",
"gulp-minifier": "^3.5.0",
"gulp-minify-inline": "^1.1.0",
"gulp-notify": "^4.0.0",
"gulp-rename": "^2.0.0",
Expand Down

0 comments on commit 0e01db2

Please sign in to comment.