Skip to content

imagemin dependency #2

Open
Open

Description

@sosiristseng

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

Activity

  1. stevenjoezhang commented on Jul 27, 2020

    @stevenjoezhang
    Member

    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.

  2. stale commented on Sep 27, 2020

    @stale

    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.

  3. added
    bug
    on Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions