Skip to content

imagemin dependency #2

Open
Open
@sosiristseng

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions