I'm using Gulp-load-plugins (https://github.com/jackfranklin/gulp-load-plugins) to require all my plugins automatically.
As in
// Load Gulp plugins
var plugins = require('gulp-load-plugins')();
Now to use imagemin, I have the following setup
// Imagemin
.pipe(plugins.imagemin({
optimizationLevel: 3,
progressive: true,
svgoPlugins: [{
removeViewBox: false
}],
interlaced: true,
use: [plugins.svgo()]
}))
But I get the error "TypeError: Object # has no method 'svgo'". In the documentation of imagemin, they require the optimisers separately. Is this possible in combination with the grunt-load-plugins module? If so, how?
Thanks in advance.
I think that you should install imagemin-svgo plugin to get this work, because it is not included by default to
gulp-imagemin
like precised at the bottom line of the README.Install it using
npm
:And
require
it in yourgulpfile
since thegulp-load-plugins
follow thegulp-*
pattern and will not load it. And call it in theuse options
like you did before.