Skip to content

Commit

Permalink
change phantomjs to phantomjs-prebuild. add protocol in highlight.
Browse files Browse the repository at this point in the history
  • Loading branch information
kind-hearted committed Jun 28, 2017
1 parent c0d09f6 commit 7232520
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var PHANTOMJS_SCRIPT_DIR = path.join(__dirname, 'phantomjs');
var PHANTOMJS_SCRIPT_FILE = path.join(PHANTOMJS_SCRIPT_DIR, 'index.js');
var _ = require('./util.js');
var _exists = fs.existsSync || path.existsSync;
var phantomjs = require('phantomjs');
var phantomjs = require('phantomjs-prebuilt');
var binPath = phantomjs.path;

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"diff"
],
"dependencies": {
"phantomjs": "~1.9.16"
"phantomjs-prebuilt": "^2.1.14"
},
"repository": {
"type": "git",
Expand Down
7 changes: 4 additions & 3 deletions phantomjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,12 @@ M.prototype.highlight = function(left, right, diff, lOffset, rOffset, callback){
log('diff [' + left + '] width [' + right + ']');
log('has [' + diff.length + '] changes');
var render = this.getRenderOptions();
var lScreenshot = this.root + '/' + left + '/' + SCREENSHOT_FILENAME + '.' + render.ext;
var rScreenshot = this.root + '/' + right + '/' + SCREENSHOT_FILENAME + '.' + render.ext;
var protocol = 'file://' + (IS_WIN ? '/' : '');
var lScreenshot = protocol + this.root + '/' + left + '/' + SCREENSHOT_FILENAME + '.' + render.ext;
var rScreenshot = protocol + this.root + '/' + right + '/' + SCREENSHOT_FILENAME + '.' + render.ext;
var dScreenshot = this.root + '/diff/' + left + '-' + right + '.' + render.ext;
var html = phantom.libraryPath + '/' + HIGHLIGHT_HTML_FILENAME;
var url = 'file://' + (IS_WIN ? '/' : '') + html + '?';
var url = protocol + html + '?';
var opt = {
page : {
settings: {
Expand Down

0 comments on commit 7232520

Please sign in to comment.