How to use the imagemin/package.json.version function in imagemin

To help you get started, we’ve selected a few imagemin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github itgalaxy / imagemin-webpack / src / minify.js View on Github external
options.maxConcurrency || Math.max(1, cpus.length - 1)
    );

    let cacheDir = null;
    let imageminVersion = null;
    let packageVersion = null;

    if (options.cache) {
      cacheDir =
        options.cache === true
          ? findCacheDir({ name: "imagemin-webpack" }) || os.tmpdir()
          : options.cache;

      try {
        // eslint-disable-next-line global-require
        imageminVersion = require("imagemin/package.json").version;
      } catch (ignoreError) {
        /* istanbul ignore next */
        imageminVersion = "unknown";
        // Nothing
      }

      try {
        // eslint-disable-next-line global-require
        packageVersion = require("../package.json").version;
      } catch (ignoreError) {
        /* istanbul ignore next */
        packageVersion = "unknown";
        // Nothing
      }
    }

imagemin

Minify images seamlessly

MIT
Latest version published 6 months ago

Package Health Score

79 / 100
Full package analysis