I got out v5 at last, which switched from PhantomJS to Puppeteer. This was an important release as PhantomJS is no longer maintained. Because of this, I tried to keep the breaking changes to a minimum. There are however lots of improvements I would like to do to the API, but which can be done sometime in the future. Here are some rough ideas:
Options:
transparent
=> defaultBackground
and make it true
by default (since it's inverted)username
=> authentication.username
password
=> authentication.password
scale
=> scaleFactor
and change the default value from 1
to 2
crop
=> fullPage
and make it true
by default (since it's inverted)format
=> type
(and value jpg
=> jpeg
)selector
=> element
css
=> styles
and accept type string[]
instead of string
script
=> scripts
and accept type string[]
instead of string
hide
=> hideElements
and accept type string[]
instead of string
API:
.src()
=> .source()
.dest()
=> .destination()
I would also like to move away from the chainable API to a single method call.
const Pageres = require('pageres');
(async () => {
await new Pageres({delay: 2})
.src('https://github.com/sindresorhus/pageres', ['480x320', '1024x768'], {crop: true})
.src('https://sindresorhus.com', ['1280x1024', '1920x1080'])
.dest('output')
.run();
})();
const pageres = require('pageres');
(async () => {
await pageres({
sources: [
{
url: 'https://github.com/sindresorhus/pageres',
sizes: ['480x320', '1024x768'],
// These options override the global ones
delay: 4
}
]
destination: 'output',
delay: 2
});
})();
Thoughts?
'480x320'
=> {width: 480, height: 320}
? Or support both?sources
item specific options be top-level in the source object (like in the above example) or nested inside {options: {delay: 4}}
?Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too