From e64428943554d91f9424249dd4b845e1066873a9 Mon Sep 17 00:00:00 2001 From: lindongwu Date: Wed, 3 Jan 2018 16:39:06 +0800 Subject: [PATCH 1/5] Add executablePath to options --- src/puppeteer_utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/puppeteer_utils.js b/src/puppeteer_utils.js index 6b18bfff..c2904dc6 100644 --- a/src/puppeteer_utils.js +++ b/src/puppeteer_utils.js @@ -135,6 +135,7 @@ const crawl = async opt => { const browser = await puppeteer.launch({ headless: options.headless, args: options.puppeteerArgs, + executablePath: options.executablePath, handleSIGINT: false }); From 8c246dc315961da7d4866a523721e5b5109eb60f Mon Sep 17 00:00:00 2001 From: lindongwu Date: Wed, 3 Jan 2018 16:50:56 +0800 Subject: [PATCH 2/5] Default option for puppeteerExecutablePath --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 218c3499..a029ba36 100644 --- a/index.js +++ b/index.js @@ -24,6 +24,7 @@ const defaultOptions = { userAgent: "ReactSnap", headless: true, puppeteerArgs: [], + puppeteerExecutablePath: undefined, publicPath: "/", minifyCss: {}, minifyHtml: { From 4b58d35e065392fe130bd86c67997fa9c9a25bc7 Mon Sep 17 00:00:00 2001 From: lindongwu Date: Wed, 3 Jan 2018 16:57:22 +0800 Subject: [PATCH 3/5] Fix puppeteerExecutablePath variable name --- src/puppeteer_utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/puppeteer_utils.js b/src/puppeteer_utils.js index c2904dc6..281a7afe 100644 --- a/src/puppeteer_utils.js +++ b/src/puppeteer_utils.js @@ -135,7 +135,7 @@ const crawl = async opt => { const browser = await puppeteer.launch({ headless: options.headless, args: options.puppeteerArgs, - executablePath: options.executablePath, + executablePath: options.puppeteerExecutablePath, handleSIGINT: false }); From de354f7ea2a9063d0a1bb1342468539a77c2c435 Mon Sep 17 00:00:00 2001 From: lindongwu Date: Wed, 3 Jan 2018 17:17:08 +0800 Subject: [PATCH 4/5] Add doc for puppeteerExecutablePath --- Readme.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Readme.md b/Readme.md index 658052e2..24a154c7 100644 --- a/Readme.md +++ b/Readme.md @@ -97,6 +97,12 @@ Use `inlineCss: true` to enable this feature. TODO: as soon as the feature will be stable it should be enabled by default. +### puppeteerExecutablePath + +To run `react-snap` inside environment likes docker, you might want to use custom chromium executable. + +For example, use `puppeteerExecutablePath: "/usr/bin/chromium-browser"` you can set chromium executable path to `/usr/bin/chromium-browser`. + ## ⚠️ Caveats ### Async components From 23ce4b0c3aec312c6b562862e01e31931bb92ee2 Mon Sep 17 00:00:00 2001 From: lindongwu Date: Wed, 3 Jan 2018 17:46:08 +0800 Subject: [PATCH 5/5] Move puppeteerExecutablePath explaination to restricted environments part --- Readme.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Readme.md b/Readme.md index 24a154c7..e58e1357 100644 --- a/Readme.md +++ b/Readme.md @@ -97,12 +97,6 @@ Use `inlineCss: true` to enable this feature. TODO: as soon as the feature will be stable it should be enabled by default. -### puppeteerExecutablePath - -To run `react-snap` inside environment likes docker, you might want to use custom chromium executable. - -For example, use `puppeteerExecutablePath: "/usr/bin/chromium-browser"` you can set chromium executable path to `/usr/bin/chromium-browser`. - ## ⚠️ Caveats ### Async components @@ -208,6 +202,12 @@ you may use Read more about [puppeteer troubleshooting.](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) +#### Docker + +To run `react-snap` inside docker (especially when using alpine), you might want to use custom chromium executable. + +For example, use `puppeteerExecutablePath: "/usr/bin/chromium-browser"` you can set chromium executable path to `/usr/bin/chromium-browser`. + ### Semantic UI [Semantic UI](https://semantic-ui.com/) is defined over class substrings that contain spaces