From c788281c28f17ebd8af0e4379874e96e940b2ae4 Mon Sep 17 00:00:00 2001 From: Heidi Dong Date: Tue, 13 May 2014 17:52:39 -0700 Subject: [PATCH] allow stylesheet urls to be passed to config --- src/renderer.coffee | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/renderer.coffee b/src/renderer.coffee index 2951555b9e..078622003b 100644 --- a/src/renderer.coffee +++ b/src/renderer.coffee @@ -81,6 +81,7 @@ class Renderer this.addStyles(DEFAULT_STYLES) # Ensure user specified styles are added after modules' _.defer(_.bind(this.addStyles, this, @options.styles)) if @options.styles? + _.defer(_.bind(this.addStyleSheet, this, @options.stylesheet)) if @options.stylesheet? addContainer: (className, before = false) -> refNode = if before then @root else null @@ -103,5 +104,13 @@ class Renderer @emitter.emit(@emitter.constructor.events.RENDER_UPDATE, css) if @emitter? ) + addStyleSheet: (url) -> + link = @root.ownerDocument.createElement('link') + link.type = 'text/css' + link.rel = 'stylesheet' + link.href = url + _.defer( => + @root.ownerDocument.querySelector('head').appendChild(link) + ) module.exports = Renderer