Break out window.applyStylesheet from window.requireStylesheet

This will be useful in applying generated stylesheets associated with themes.
This commit is contained in:
Nathan Sobo
2012-08-08 16:09:23 -06:00
parent 3376dead06
commit 2df05e235a
2 changed files with 8 additions and 6 deletions

View File

@@ -53,9 +53,11 @@ windowAdditions =
requireStylesheet: (path) ->
fullPath = require.resolve(path)
content = fs.read(fullPath)
return if $("head style[path='#{fullPath}']").length
$('head').append "<style path='#{fullPath}'>#{content}</style>"
window.applyStylesheet(fullPath, fs.read(fullPath))
applyStylesheet: (id, text) ->
unless $("head style[id='#{id}']").length
$('head').append "<style id='#{id}'>#{text}</style>"
requireExtension: (name) ->
extensionPath = require.resolve name