Created
May 30, 2014 21:45
-
-
Save gfranko/0038572f20b30af25405 to your computer and use it in GitHub Desktop.
node-webshot enhancement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any reason why the style is inserted first, rather than last?