Load package stylesheets right before activation

Previously this was done eagerly for packages using activation events.
This commit is contained in:
Kevin Sawicki
2013-09-24 20:24:33 -07:00
parent 00c0baeceb
commit d4047c80cb

View File

@@ -65,6 +65,7 @@ class AtomPackage extends Package
activateNow: ->
try
@activateConfig()
@activateStylesheets()
if @requireMainModule()
@mainModule.activate(atom.getPackageState(@name) ? {})
@mainActivated = true
@@ -80,11 +81,13 @@ class AtomPackage extends Package
@mainModule.activateConfig?()
@configActivated = true
activateStylesheets: ->
type = if @metadata.theme then 'theme' else 'bundled'
applyStylesheet(stylesheetPath, content, type) for [stylesheetPath, content] in @stylesheets
activateResources: ->
keymap.add(keymapPath, map) for [keymapPath, map] in @keymaps
atom.contextMenu.add(menuPath, map['context-menu']) for [menuPath, map] in @menus
type = if @metadata.theme then 'theme' else 'bundled'
applyStylesheet(stylesheetPath, content, type) for [stylesheetPath, content] in @stylesheets
syntax.addGrammar(grammar) for grammar in @grammars
for [scopedPropertiesPath, selector, properties] in @scopedProperties
syntax.addProperties(scopedPropertiesPath, selector, properties)