From 14bce2746fd2d16b8802f25a72f2e38a39822880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20M=C3=BCller?= Date: Wed, 26 Mar 2014 20:45:56 +0100 Subject: [PATCH] Make pngquant-bin an optional dependency. --- lib/PngQuant.js | 8 +++++++- package.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/PngQuant.js b/lib/PngQuant.js index 24d85dd..a8b1dfe 100644 --- a/lib/PngQuant.js +++ b/lib/PngQuant.js @@ -1,7 +1,13 @@ var childProcess = require('child_process'), Stream = require('stream').Stream, util = require('util'), - binPath = require('pngquant-bin').path; + pngQuantBin; + +try { + pngQuantBin = require('pngquant-bin'); +} catch (e) {} + +var binPath = pngQuantBin ? pngQuantBin.path : 'pngquant'; function PngQuant(pngQuantArgs) { Stream.call(this); diff --git a/package.json b/package.json index dd0b27e..27e3973 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "directories": { "test": "test" }, - "dependencies": { + "optionalDependencies": { "pngquant-bin": "=0.1.7" }, "devDependencies": {