Skip to content

Commit 0d47ab0

Browse files
committed
rm custom puppeteer/chromium option
1 parent efa104e commit 0d47ab0

File tree

4 files changed

+4
-68
lines changed

4 files changed

+4
-68
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@
4646
},
4747
"devDependencies": {
4848
"ava": "^1.3.1",
49-
"chromium": "^2.1.0",
5049
"create-test-server": "^2.4.0",
5150
"prettier": "^1.16.4",
52-
"puppeteer-core": "^1.13.0",
5351
"xo": "^0.24.0"
5452
},
5553
"dependencies": {

readme.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,6 @@ Type: `String` Default: `networkidle2`
7979
Can be any value as provided by the
8080
[Puppeteer docs](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagegotourl-options).
8181

82-
#### customBrowser
83-
84-
Type: `Object` Default: `null`
85-
86-
This is useful if you want to run extract-css on AWS Lambda for example.
87-
88-
##### executablePath
89-
90-
Type: `String` Default: `null`
91-
92-
Pass in the executable path for a custom Chromium instance.
93-
94-
##### customPuppeteer
95-
96-
Type: `Object` Default: `null`
97-
98-
You probably want to provide
99-
[puppeteer-core](https://www.npmjs.com/package/puppeteer-core) for a custom
100-
browser instead of [puppeteer](https://www.npmjs.com/package/puppeteer) which
101-
brings it's own Chromium instance.
102-
10382
## Related
10483

10584
- [extract-css lambda](https://github.com/bartveneman/extract-css) - Extract CSS

src/index.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,12 @@ InvalidUrlError.prototype = Error.prototype
99

1010
module.exports = async (
1111
url,
12-
{debug = false, waitUntil = 'networkidle2', customBrowser = null} = {}
12+
{debug = false, waitUntil = 'networkidle2'} = {}
1313
) => {
14-
const browserOptions = {
15-
headless: debug !== true,
16-
puppeteer
17-
}
18-
19-
// Replace the puppeteer instance if a custom one is provided
20-
// This also means that the executablePath needs to be set to
21-
// a custom path where some chromium instance is running.
22-
if (
23-
customBrowser &&
24-
customBrowser.executablePath &&
25-
customBrowser.puppeteer &&
26-
customBrowser.args
27-
) {
28-
browserOptions.executablePath = customBrowser.executablePath
29-
browserOptions.puppeteer = customBrowser.puppeteer
30-
browserOptions.args = customBrowser.args
31-
}
32-
3314
// Setup a browser instance
34-
const browser = await browserOptions.puppeteer.launch(browserOptions)
15+
const browser = await puppeteer.launch({
16+
headless: debug !== true
17+
})
3518

3619
// Create a new page and navigate to it
3720
const page = await browser.newPage()

test/index.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -113,30 +113,6 @@ test('it rejects on an invalid url', async t => {
113113
await t.throwsAsync(extractCss('site.example'))
114114
})
115115

116-
test('it accepts a custom Chrome and Puppeteer version for use on AWS', async t => {
117-
const chromium = require('chromium')
118-
const puppeteerCore = require('puppeteer-core')
119-
120-
const path = '/custom-chrome'
121-
const kitchenSinkExample = readFileSync(
122-
resolve(__dirname, 'kitchen-sink.html'),
123-
'utf8'
124-
)
125-
server.get(path, (req, res) => {
126-
res.send(kitchenSinkExample)
127-
})
128-
129-
const actual = await extractCss(server.url + path, {
130-
customBrowser: {
131-
executablePath: chromium.path,
132-
puppeteer: puppeteerCore,
133-
args: chromium.args
134-
}
135-
})
136-
137-
t.snapshot(actual)
138-
})
139-
140116
// TODO: write coverage for dynamically inserted style tags
141117
test.skip('it finds CSS-in-JS (styled components)', async t => {
142118
const path = '/css-in-js'

0 commit comments

Comments
 (0)