Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #73 from boardbang/master
Browse files Browse the repository at this point in the history
Added ability to set phantom viewport dimensions
  • Loading branch information
drewlustro authored Jul 14, 2017
2 parents c5b1376 + 2e7cd6d commit 71c8d04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ module.exports = {
phantomPageSettings: {
loadImages: true
},


// http://phantomjs.org/api/webpage/property/viewport-size.html
phantomPageViewportSize: {
width: 1280,
height: 800
},

// Manually transform the HTML for each page after prerendering,
// for example to set the page title and metadata in edge cases
// where you cannot handle this via your routing solution.
Expand Down
4 changes: 4 additions & 0 deletions lib/phantom-page-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ if (options.phantomPageSettings) {
page.settings = defaultsDeep(options.phantomPageSettings, page.settings)
}

if (options.phantomPageViewportSize) {
page.viewportSize = options.phantomPageViewportSize
}

page.open(url, function (status) {
if (status !== 'success') {
throw new Error('FAIL to load: ' + url)
Expand Down

0 comments on commit 71c8d04

Please # to comment.