Skip to content

Commit

Permalink
fix: write content in a file it opts.path is present (#93)
Browse files Browse the repository at this point in the history
* build: avoid block the process under errors

* build: tweaks cli flags

* fix: write content in a file it opts.path is present
  • Loading branch information
Kikobeats committed Sep 25, 2019
1 parent 5e35525 commit 34df725
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/screenshot/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,16 @@ module.exports = gotoOpts => {

if (!overlay) return screenshot

const { browser: browserTheme, background } = overlay

const { browser: browserSkin, background } = overlay
let image = await sharp(await getBackground(background))
let inputs = [{ input: screenshot }]

if (browserTheme) {
const input = browserOverlay[browserTheme]
if (browserSkin) {
const input = browserOverlay[browserSkin]
if (input) inputs = [{ input }].concat(inputs)
}

image = await image.composite(inputs)
const buffer = await image.toBuffer()
return buffer
return opts.path ? image.toFile(opts.path) : image.toBuffer()
}
}

0 comments on commit 34df725

Please sign in to comment.