From c7861874796d83533a2cc00d67c487ff6669b9fb Mon Sep 17 00:00:00 2001 From: Jeffrey Lembeck Date: Mon, 27 Oct 2014 06:11:28 -0700 Subject: [PATCH] Add phantom script --- lib/screenshotter.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/screenshotter.js diff --git a/lib/screenshotter.js b/lib/screenshotter.js new file mode 100644 index 0000000..cb7b507 --- /dev/null +++ b/lib/screenshotter.js @@ -0,0 +1,26 @@ +/*global phantom:true*/ +/*global require:true*/ +/*global window:true*/ + +/* +phantom args + [0] - url + [1] - output +*/ +(function(){ + "use strict"; + + var page = require( "webpage" ).create(); + + var site = phantom.args[0], + output = phantom.args[1]; + + page.open( site, function( status ){ + if( status !== "success" ){ + phantom.exit( 1 ); + } + page.render( output + ".png" ); + phantom.exit( 0 ); + }); + +}());