Hexo-theme-next: Need to remove unnecessary line breaks

Created on 25 May 2017  ·  3Comments  ·  Source: iissnan/hexo-theme-next

Expected behavior (预期行为)

There should be no unnecessary line breaks.

Actual behavior (实际行为)

In fact, there are extra line breaks.

Steps to reproduce the behavior (重现步骤)

See the screenshot attached to this issue.

NexT Version:

  • ✔ Master
  • Latest Release
  • Old version -

NexT Scheme:

  • All schemes
  • Muse
  • Mist
  • ✔ Pisces

Other Information (Like Browser, System, Screenshots)

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

25 05 2017_10h57m28s

Most helpful comment

you can use gulp-htmlclean and gulp-htmlmin to solve your problem !

npm install gulp-htmlmin --save-dev
npm install gulp-htmlclean --save-dev
  • gulp-htmlmin--压缩html,可以压缩页面javascript、css,去除页面空格、注释,删除多余属性等操作文档
  • gulp-htmlclean-- null

(HexoRoot)/gulpfile.js

var gulp = require('gulp');
var htmlmin = require('gulp-htmlmin');
var htmlclean = require('gulp-htmlclean');
// 
gulp.task('minify-html', function() {
  return gulp.src('./public/**/*.html')
  .pipe(htmlclean())
  .pipe(htmlmin({
    removeComments: true,
    minifyJS: true,
    minifyCSS: true,
    minifyURLs: true,
  }))
  .pipe(gulp.dest('./public'))
});
// default task
gulp.task('default', [
  'minify-html'
]);

run this command


the end ~

All 3 comments

you can use gulp-htmlclean and gulp-htmlmin to solve your problem !

npm install gulp-htmlmin --save-dev
npm install gulp-htmlclean --save-dev
  • gulp-htmlmin--压缩html,可以压缩页面javascript、css,去除页面空格、注释,删除多余属性等操作文档
  • gulp-htmlclean-- null

(HexoRoot)/gulpfile.js

var gulp = require('gulp');
var htmlmin = require('gulp-htmlmin');
var htmlclean = require('gulp-htmlclean');
// 
gulp.task('minify-html', function() {
  return gulp.src('./public/**/*.html')
  .pipe(htmlclean())
  .pipe(htmlmin({
    removeComments: true,
    minifyJS: true,
    minifyCSS: true,
    minifyURLs: true,
  }))
  .pipe(gulp.dest('./public'))
});
// default task
gulp.task('default', [
  'minify-html'
]);

run this command


the end ~

good idea

HTML minification plugins may help in this. Also, this is not big problem with this line breaks and search engines do not see this. So, no need to do this for now, need to do other great and usable things instead this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DVD0423 picture DVD0423  ·  3Comments

ifgao picture ifgao  ·  4Comments

chy9002 picture chy9002  ·  3Comments

jwwangchn picture jwwangchn  ·  3Comments

Nirvanada picture Nirvanada  ·  4Comments