Reload the stylesheet when it is applied >1x

This commit is contained in:
Ben Ogle
2013-09-10 15:20:15 -07:00
parent d2e125357a
commit b48a35fc14

View File

@@ -178,7 +178,11 @@ window.removeStylesheet = (stylesheetPath) ->
window.stylesheetElementForId(fullPath).remove()
window.applyStylesheet = (id, text, ttype = 'bundled') ->
unless window.stylesheetElementForId(id).length
styleElement = window.stylesheetElementForId(id)
if styleElement.length
console.log 'replacing style in', styleElement
styleElement.text(text)
else
if $("head style.#{ttype}").length
$("head style.#{ttype}:last").after "<style class='#{ttype}' id='#{id}'>#{text}</style>"
else