Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

oraneedwards commented Dec 10, 2016

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
You can’t perform that action at this time.