Skip to content

Instantly share code, notes, and snippets.

@gfranko
Created May 30, 2014 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfranko/0038572f20b30af25405 to your computer and use it in GitHub Desktop.
Save gfranko/0038572f20b30af25405 to your computer and use it in GitHub Desktop.
node-webshot enhancement
// Handle customCSS option
if (typeof options.customCSS === 'string') {
page.evaluate(function(customCSS) {
var style = document.createElement('style');
var text = document.createTextNode(customCSS);
style.setAttribute('type', 'text/css');
style.appendChild(text);
document.head.insertBefore(style, document.head.firstChild);
}, options.customCSS);
}
@oraneedwards
Copy link

Any reason why the style is inserted first, rather than last?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment