S
S
SwaG2018-06-23 17:52:09
JavaScript
SwaG, 2018-06-23 17:52:09

How to compress images through NPM scripts?

I'm looking for an npm package that will compress images in a folder specified in the project on the PC and all folders inside it. You need to run something like "npm --img-compression". Could you tell me, please, what package can be used to do something like this?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Y
yakupov112, 2018-06-23
@yakupov112

https://github.com/sindresorhus/gulp-imagemin

E
Egor Danchenko, 2018-06-23
@DanchenkoEgor

There is a ready-made Gulp plugin for this.
There are many vids on youtube on it.

E
Egor Zhivagin, 2018-06-23
@Krasnodar_etc

imagemin (without Gulp)
Install a module, make a file according to the model. It will be launched via node fileName.js
If desired, you can add an alias to package.json --> scripts and call vianpm run aliasName

V
Valery, 2014-10-06
@all23081992

To open a spinner, it is usually enough to make
sure that this method is called after the spinner has been initialized and does not entail other errors.
In such matters, the code will not be superfluous.
Try like this:

new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                spinner.performClick();
            }
        }, 200);

new AsyncTask<Void, Void, Void>() {

            @Override
            protected Void doInBackground(Void... voids) {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        spinner.notifyDataSetChanged();
                    }
                });
                return null;
            }

            @Override
            protected void onPostExecute(Void aVoid) {
                super.onPostExecute(aVoid);
                spinner.performClick();
            }
        }.execute();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question