hexojs / hexo-html-minifier

Minify HTML files with HTMLMinifier.
MIT License
27 stars 12 forks source link

wont work with hexo3 #1

Closed wayou closed 6 years ago

wayou commented 9 years ago

when hexo-html-minifier enabled, hexo s or hexo g the terminal get stuck. once remove hexo-html-minifier, everything's okay.

here's the hexo version im using on mac:

$ hexo -v hexo: 3.1.1 os: Darwin 14.5.0 darwin x64 http_parser: 2.3 node: 0.12.7 v8: 3.28.71.19 uv: 1.6.1 zlib: 1.2.8 modules: 14 openssl: 1.0.1p

and here's the hexo-html-minifier section within the _config.yml for my blog:


html_minifier:
  exclude: 

and here's the package dependencies:

"dependencies": {
    "hexo": "^3.1.0",
    "hexo-browsersync": "^0.1.1",
    "hexo-clean-css": "0.0.2",
    "hexo-deployer-git": "0.0.4",
    "hexo-generator-archive": "^0.1.2",
    "hexo-generator-category": "^0.1.2",
    "hexo-generator-feed": "^1.0.2",
    "hexo-generator-index": "^0.1.2",
    "hexo-generator-tag": "^0.1.1",
    "hexo-html-minifier": "0.0.1",
    "hexo-renderer-ejs": "^0.1.0",
    "hexo-renderer-marked": "^0.2.5",
    "hexo-renderer-stylus": "^0.2.0",
    "hexo-server": "^0.1.2",
    "hexo-uglify": "0.0.3"
  }
matthewsanders commented 9 years ago

This seems to work on mine.

Here is my version info:

$ hexo -v hexo: 3.1.1 os: Darwin 13.2.0 darwin x64 http_parser: 2.5.0 node: 4.1.0 v8: 4.5.103.33 uv: 1.7.4 zlib: 1.2.8 ares: 1.10.1-DEV modules: 46 openssl: 1.0.2d

This is my hexo-html-minifier in my _config.yml:

# Minifier
# Note: can wrap a chunk in: 
# <!-- htmlmin:ignore -->
# to have the minifier ignore a section
html_minifier:
  exclude:
  removeComments: true
  removeCommentsFromCDATA: true
  removeCDATASectionsFromCDATA: true
  collapseWhitespace: true
  conservativeCollapse: true
  preserveLineBreaks: true
  collapseBooleanAttributes: true
  removeAttributeQuotes: false
  removeRedundantAttributes: true
  preventAttributesEscaping: false
  useShortDoctype: false
  removeEmptyAttributes: true
  removeScriptTypeAttributes: false
  removeStyleLinkTypeAttributes: false
  removeOptionalTags: false
  removeIgnored: true
  removeEmptyElements: false # This appears to break if set to true
  lint: false
  keepClosingSlash: false
  caseSensitive: false
  minifyJS: true
  minifyCSS: true
  minifyURLs: false
  #ignoreCustomComments
  #processScripts
  #maxLineLength
  #customAttrAssign
  #customAttrSurround
  #customAttrCollapse
  #quoteCharacter

My dependencies are a little different as well. I actually installed the minifier from my fork. I haven't changed anything yet. The documentation for this is poor so I didn't realize I could disable/enable it and was going to modify to allow for some options. Then after examining the source and following the link in the read me I noticed I could use the options above.

  "dependencies": {
    "hexo": "^3.1.0",
    "hexo-deployer-git": "0.0.4",
    "hexo-generator-archive": "^0.1.2",
    "hexo-generator-category": "^0.1.2",
    "hexo-generator-feed": "^1.0.3",
    "hexo-generator-index": "^0.1.2",
    "hexo-generator-tag": "^0.1.1",
    "hexo-html-minifier": "https://github.com/matthewsanders/hexo-html-minifier/tarball/master",
    "hexo-renderer-ejs": "^0.1.0",
    "hexo-renderer-marked": "^0.2.4",
    "hexo-renderer-stylus": "^0.3.0",
    "hexo-server": "^0.1.2"
  }```
wayou commented 9 years ago

"hexo-html-minifier": "https://github.com/matthewsanders/hexo-html-minifier/tarball/master",

your forked and fixed something?

matthewsanders commented 9 years ago

No. I mentioned above that I had forked with the intention to allow disable/enable support while developing. I didn't notice that I could add the options from the child package for this.

I may still add some universal options, but if I do I would submit a pull request.

I just noticed you are not using the options and by default it should be disabled.

The terminal issue you have is likely a different issue though. We have different versions reported with -v.

giuem commented 9 years ago

我也遇到这个问题,好像和主题有关

Unhandled rejection Error: Uncaught, unspecified "error" event.
    at Error (native)
    at RouteStream.emit (events.js:87:13)
    at d:\hexo\blog\node_modules\hexo\lib\hexo\router.js:156:10
    at tryCatcher (d:\hexo\blog\node_modules\hexo\node_modules\bluebird\js\main\util.
js:26:23)
    at Promise._settlePromiseFromHandler (d:\hexo\blog\node_modules\hexo\node_modules
\bluebird\js\main\promise.js:507:31)
    at Promise._settlePromiseAt (d:\hexo\blog\node_modules\hexo\node_modules\bluebird
\js\main\promise.js:581:18)
    at Async._drainQueue (d:\hexo\blog\node_modules\hexo\node_modules\bluebird\js\mai
n\async.js:128:12)
    at Async._drainQueues (d:\hexo\blog\node_modules\hexo\node_modules\bluebird\js\ma
in\async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (d:\hexo\blog\node_modules\hexo\
node_modules\bluebird\js\main\async.js:15:14)
    at processImmediate [as _immediateCallback] (timers.js:367:17)
pozitron57 commented 8 years ago

Cannot generate files with this plugin.

hexo: 3.1.1 os: Linux 3.16.0-43-generic linux x64 http_parser: 2.3 node: 0.12.7 v8: 3.28.71.19 uv: 1.6.1 zlib: 1.2.8 modules: 14 openssl: 1.0.1p

FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html

er1x commented 8 years ago

Same error as @pozitron57

hexo: 3.1.1 os: Linux 3.16.0-38-generic linux x64 http_parser: 2.6.0 node: 5.1.0 v8: 4.6.85.31 uv: 1.7.5 zlib: 1.2.8 ares: 1.10.1-DEV icu: 56.1 modules: 47 openssl: 1.0.2d

wayou commented 8 years ago

我也遇到这个问题,好像和主题有关

@giuem 其他主题成功了?

zhangjh commented 8 years ago

The same error as @wayou Uninstall this plugin hexo generate success.BUT it confused me that : it was ok some days before, and I do nothing else but added some md files ...

matthewsanders commented 8 years ago

Mine worked on hexo 3.1.1 I recently tried to update to hexo 3.2.0 and now it only minifies the article content (nested in <div class="article-entry" itemprop="articleBody">) when it used to minify the full page.

I am still using the same configuration as above.

frankbroniewski commented 8 years ago

For me the plugin does nothing, neither in articles nor in pages. All the comments are preserved despite setting removeComments: true this is on: hexo: 3.2.2 hexo-cli: 1.0.2 os: Windows_NT 10.0.10586 win32 x64 http_parser: 2.5.0 node: 4.2.4 v8: 4.5.103.35 uv: 1.7.5 zlib: 1.2.8 ares: 1.10.1-DEV icu: 56.1 modules: 46 openssl: 1.0.2e

wayou commented 8 years ago

I've switched to hexo-all-minifier. Hope this can help those who still encountering this.

tomap commented 6 years ago

This issue seems very old. The plugin is marked as requiring node >= 6, maybe that was the issue

If someone has a way to reproduce this issue, please open a new issue and reference this one. I'm closing this on in the meantime