diff --git a/index.js b/index.js index abb3a1b..5184859 100644 --- a/index.js +++ b/index.js @@ -4,11 +4,12 @@ var path = require('path'); var fs = require('fs'); var crypto = require('crypto'); +var isWin = /^win/.test(process.platform); //Temporary workaround for https://github.com/ariya/phantomjs/issues/14194 var postcss = require('postcss'); var async = require('async'); var when = require('when'); -var phantomjs = require('phantomjs'); +var phantomjs = require('phantomjs-prebuilt'); var childProcess = require('child_process'); var phantomjsScript = path.resolve(__dirname, './phantomjs-script.js'); @@ -132,12 +133,13 @@ module.exports = postcss.plugin('postcss-svg-fallback', function(options) { }); function processImage(options, image, cb) { - var source = path.join(options.basePath || '', image.image); + var source = path.resolve(path.join(options.basePath || '', image.image)); + var sourceUrl = isWin ? 'file:///' + source : source; var dest = path.join(options.dest || '', image.newImage); var args = [ phantomjsScript, - image.inline ? image.image : source, + image.inline ? image.image : sourceUrl, image.size.width, image.size.height, dest, diff --git a/package.json b/package.json index 0faa6e0..b614822 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "main": "index.js", "dependencies": { "postcss": "~4.1.9", - "phantomjs": "~1.9.16", + "phantomjs-prebuilt": "~2.1.7", "async": "~0.9.0", "when": "~3.7.3" }, diff --git a/test/images/expected-800f6893213eec77f13405f4a806b6c1-20x20.png b/test/images/expected-800f6893213eec77f13405f4a806b6c1-20x20.png index 9ae0678..1618ff9 100644 Binary files a/test/images/expected-800f6893213eec77f13405f4a806b6c1-20x20.png and b/test/images/expected-800f6893213eec77f13405f4a806b6c1-20x20.png differ diff --git a/test/images/expected-email-20x20.png b/test/images/expected-email-20x20.png index 9ae0678..1618ff9 100644 Binary files a/test/images/expected-email-20x20.png and b/test/images/expected-email-20x20.png differ