Skip to content

Commit

Permalink
better screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
plantain-00 committed Aug 28, 2017
1 parent 434bc2f commit 6b71ac7
Show file tree
Hide file tree
Showing 10 changed files with 1,793 additions and 93 deletions.
4 changes: 3 additions & 1 deletion clean-scripts.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ module.exports = {
const { createServer } = require('http-server')
const puppeteer = require('puppeteer')
const fs = require('fs')
const beautify = require('js-beautify').html
const server = createServer()
server.listen(8000)
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.emulate({ viewport: { width: 1440, height: 900 }, userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36' })
for (const type of ['vue', 'react', 'angular']) {
await page.goto(`http://localhost:8000/demo/${type}`)
await page.screenshot({ path: `demo/${type}/screenshot.png`, fullPage: true })
const content = await page.content()
fs.writeFileSync(`demo/${type}/screenshot-src.html`, content)
fs.writeFileSync(`demo/${type}/screenshot-src.html`, beautify(content))
}
server.close()
browser.close()
Expand Down
859 changes: 817 additions & 42 deletions demo/angular/screenshot-src.html

Large diffs are not rendered by default.

Binary file modified demo/angular/screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
374 changes: 359 additions & 15 deletions demo/react/screenshot-src.html

Large diffs are not rendered by default.

Binary file modified demo/react/screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
566 changes: 532 additions & 34 deletions demo/vue/screenshot-src.html

Large diffs are not rendered by default.

Binary file modified demo/vue/screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"http-server": "0.10.0",
"image2base64-cli": "2.1.0",
"jasmine": "2.7.0",
"js-beautify": "1.6.14",
"karma": "1.7.0",
"karma-chrome-launcher": "2.2.0",
"karma-firefox-launcher": "1.0.1",
Expand Down
3 changes: 2 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"no-unused-expression": [
true,
"allow-new"
]
],
"no-submodule-imports": false
}
}

0 comments on commit 6b71ac7

Please sign in to comment.