brenden / node-webshot

Easy website screenshots in Node.js
2.12k stars 285 forks source link

New Option - customCSS #65

Closed gfranko closed 10 years ago

gfranko commented 10 years ago

This PR adds a new customCSS option that allows a user to pass custom CSS rules that will be applied to a webpage before the screenshot will be taken.

Example

webshot('http://google.com', 'screenshot.png', {
  'customCSS': 'body { background: blue !important; }'
}, function(err) {

});

Note: I wasn't sure how to adequately test this with Mocha and ImageMagick, so I only verified that it works manually.

brenden commented 10 years ago

Way cool, I'll merge this. Note that it's best not to use typeof to check for a string because typeof 'abc' != typeof new String('abc'). Otherwise looks good.

gfranko commented 10 years ago

Awesome, thanks for merging this and updating the typeof check.