next-theme / hexo-optimize

🚩 A Hexo plugin that optimize the pages loading speed, written in Rust
MIT License
14 stars 2 forks source link

`imagemin` dependency #2

Open sosiristseng opened 4 years ago

sosiristseng commented 4 years ago

Error encountered

When running hexo generate

ERROR Plugin load failed: hexo-optimize
Error: Cannot find module 'imagemin'

_config.yml was the same as README indicated.

# https://github.com/next-theme/hexo-optimize#readme
filter_optimize:
  enable: true
  # remove the surrounding comments in each of the bundled files
  remove_comments: false
  css:
    # minify all css files
    minify: true
    # bundle loaded css files into one
    bundle: true
    # use a script block to load css elements dynamically
    delivery: true
    # make specific css content inline into the html page
    #   - only support the full path
    #   - default is ['css/main.css']
    inlines:
    excludes:
  js:
    # minify all js files
    minify: true
    # bundle loaded js files into one
    bundle: true
    excludes:
  # set the priority of this plugin,
  # lower means it will be executed first, default of Hexo is 10
  priority: 12

Solution

I installed these dependencies manually and it succeeded.

npm install imagemin imagemin-mozjpeg imagemin-pngquant imagemin-gifsicle imagemin-jpegtran imagemin-optipng imagemin-svgo 

And I need to install autoconf system-wide since imagemin-gifsicle failed to fetch pre-built binary and I had to compile it.

Should we add imagemin and plugins to dependencies?

My package.json : package.zip

stevenjoezhang commented 4 years ago

Thanks for your feedback. A new version has been released to fix this issue: https://www.npmjs.com/package/hexo-optimize/v/2.5.1

Image compression is actually an unfinished feature, I'm still working on it.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.