Skip to content

Commit 2ba2383

Browse files
committed
The path to the Nightmare library can now be specified if you want to use an external version of Nightmare.
1 parent 39a41f6 commit 2ba2383

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "node_modules\\typescript\\lib"
3+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "capture-template",
3-
"version": "1.1.12",
3+
"version": "1.1.13",
44
"description": "This library is responsible for expanding a template web page and then capturing it PNG or PDF.",
55
"main": "build/index.js",
66
"types": "build/index.d.ts",

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ export interface ICaptureOptions {
7474
*/
7575
leaveBrowserOpen?: boolean;
7676

77+
/**
78+
* Specify the path to nightmare if it is to be included externally.
79+
*/
80+
nightmarePath?: string;
81+
7782
/**
7883
* Specify the path to Electron if that's necessary for you.
7984
*/

src/web-page-renderer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ export class WebPageRenderer implements IWebPageRenderer {
130130
}
131131
}
132132

133-
const Nightmare = require("nightmare");
133+
const nightmareModulePath = (this.options && this.options.nightmarePath) || "nightmare";
134+
const Nightmare = require(nightmareModulePath);
134135
this.nightmare = new Nightmare(nightmareOptions);
135136

136137
this.nightmare.on('crashed', (evt: any) => {

0 commit comments

Comments
 (0)