diff --git a/README.md b/README.md index 67f4f5e..03b3b5e 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/lib/phantom-page-render.js b/lib/phantom-page-render.js index 3cbc6d7..e2fa396 100644 --- a/lib/phantom-page-render.js +++ b/lib/phantom-page-render.js @@ -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)