Skip to content
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

Open
Webica opened this issue Sep 28, 2020 · 3 comments

Comments

@Webica
Copy link

Webica commented Sep 28, 2020

вижу что есть оптимизация png спрайта, а как же остальные изображения?

@nicothin
Copy link
Owner

nicothin commented Oct 2, 2020

Когда-то была в виде задачи при старте процесса, потом в виде отдельной команды, не помню почему я убрал команду.
Вероятно, потерялась при очередной переделке ))
Восприму ишью как фитч-реквест )

@npofopr
Copy link

npofopr commented Jan 19, 2021

вижу что есть оптимизация png спрайта, а как же остальные изображения?

Ранее, была отдельная задача для этого

// Ручная оптимизация изображений
// Использование: 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();
  }
});

@nicothin
Copy link
Owner

Вероятно, мне стоит дописать подобную задачу, запускаемую вручную, ибо автооптимизация на каждый запуск — медленно.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants