Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions mincss/download.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
var system = require('system');
var page = require('webpage').create();
page.open(phantom.args[0], function () {
//page.render('screenshot.png');
console.log(page.content);
phantom.exit();
page.viewportSize = {width: 1280, height: 1024};
page.settings.resourceTimeout = 5000;
page.onResourceTimeout = function(e) {
console.log(e.errorCode); // it'll probably be 408
console.log(e.errorString); // it'll probably be 'Network timeout on resource'
console.log(e.url); // the url whose request timed out
phantom.exit(2);
};
var url = system.args[1]
page.open(url, function (status) {
if (status !== 'success') {
console.log('Unable to load', url);
phantom.exit(1);
} else {
setTimeout(function() {
page.render('screenshot.png');
console.log(page.content);
phantom.exit(0);
}, 1000)
}
});
6 changes: 4 additions & 2 deletions mincss/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,13 @@ def download(self, url):
def download_with_phantomjs(self, url):
if self.phantomjs is True:
# otherwise, assume it's a path
self.phantomjs = 'phantomjs'
phantomjs = 'phantomjs'
elif not os.path.isfile(self.phantomjs):
raise IOError('%s is not a path to phantomjs' % self.phantomjs)
else:
phantomjs = self.phantomjs

command = [self.phantomjs]
command = [phantomjs]
if self.phantomjs_options:
if 'load-images' not in self.phantomjs_options:
# not entirely sure if this helps but there can't be any point
Expand Down