Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imagemin dependency #2

Open
sosiristseng opened this issue Jul 27, 2020 · 2 comments
Open

imagemin dependency #2

sosiristseng opened this issue Jul 27, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@sosiristseng
Copy link

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
Copy link
Member

stevenjoezhang commented Jul 27, 2020

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
Copy link

stale bot commented Sep 27, 2020

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.

@stale stale bot added the stale label Sep 27, 2020
@stevenjoezhang stevenjoezhang added the bug Something isn't working label Sep 27, 2020
@stale stale bot removed the stale label Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants