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-imageminlike precised at the bottom line of the README.Install it using
npm:And
requireit in yourgulpfilesince thegulp-load-pluginsfollow thegulp-*pattern and will not load it. And call it in theuse optionslike you did before.