-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a968ba5
commit 0ec80a4
Showing
3 changed files
with
19 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,18 @@ | |
// https://github.com/pocketjoso/penthouse | ||
// Author: Jonas Ohlsson | ||
// License: MIT | ||
// Version 0.2.0 | ||
|
||
// USAGE (when run standalone): | ||
// phantomjs penthouse.js [URL to page] [CSS file] > [critical path CSS file] | ||
|
||
// to run on HTTPS sites two flags must be passed in, directly after phantomjs in the call: | ||
// --ignore-ssl-errors=true --ssl-protocol=tlsv1 | ||
|
||
// optional parameters: [WIDTH], [HEIGHT] - must follow [CSS file] param in this order. Defaults to 1300, 900. | ||
|
||
// DEPENDENCIES | ||
// + "phantomjs" : "~1.9.7" | ||
|
||
'use strict'; | ||
|
||
|
@@ -48,15 +60,15 @@ var parseArguments = function () { | |
var options = {}; | ||
|
||
//url needs to be passed in | ||
if (system.args.length < 5) { | ||
log('Usage: penthouse <some URL> <path to css file> <width> <height>'); | ||
if (system.args.length < 3) { | ||
log('Usage: penthouse <some URL> <path to css file>'); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
fatso83
Collaborator
|
||
phantom.exit(1); | ||
} | ||
|
||
options.url = system.args[1]; | ||
options.cssFilePath = system.args[2]; | ||
options.width = system.args[3]; | ||
options.height = system.args[4]; | ||
options.width = system.args[3] || 1300; | ||
options.height = system.args[4] || 900; | ||
|
||
return options; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(I pushed the width and height to be optional from within the script, so also for standalone calls) My note here is not on this change, but on the merge of this file and the base dir penthouse.js:
This feedback is incorrect for when called standalone... Makes me wonder if we have to use two different files. Can we somehow know from inside here whether the script was called via Node or not? We would have to pass in an extra argument... which wouldn't really scale well. Any ideas?