-
Notifications
You must be signed in to change notification settings - Fork 215
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
Здесь не предусмотрена оптимизация по сжатию изображений? #98
Comments
Когда-то была в виде задачи при старте процесса, потом в виде отдельной команды, не помню почему я убрал команду. |
Ранее, была отдельная задача для этого // Ручная оптимизация изображений
// Использование: folder=src/img npm start img:opt
const folder = process.env.folder;
gulp.task('img:opt', function (callback) {
const imagemin = require('gulp-imagemin');
// const pngquant = require('imagemin-pngquant');
if(folder){
console.log('---------- Оптимизация картинок');
return gulp.src(folder + '/*.{jpg,jpeg,gif,png,svg}')
.pipe(imagemin([
imagemin.gifsicle({ interlaced: true }),
imagemin.jpegtran({ progressive: true }),
imagemin.optipng({ optimizationLevel: 5 }),
imagemin.svgo({
plugins: [
{ removeViewBox: false },
{ cleanupIDs: false }
]
})
]))
.pipe(gulp.dest(folder));
}
else {
console.log('---------- Оптимизация картинок: ошибка (не указана папка)');
console.log('---------- Пример вызова команды: folder=src/blocks/block-name/img npm start img:opt');
callback();
}
}); |
Вероятно, мне стоит дописать подобную задачу, запускаемую вручную, ибо автооптимизация на каждый запуск — медленно. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
вижу что есть оптимизация png спрайта, а как же остальные изображения?
The text was updated successfully, but these errors were encountered: