diff --git a/src/package.coffee b/src/package.coffee index 77a8a775f..c465a3cb8 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -50,6 +50,7 @@ class Package keymaps: null menus: null stylesheets: null + stylesheetDisposables: null grammars: null scopedProperties: null mainModulePath: null @@ -62,7 +63,6 @@ class Package constructor: (@path, @metadata) -> @emitter = new Emitter - @stylesheetDisposables = new CompositeDisposable @metadata ?= Package.loadMetadata(@path) @bundledPackage = Package.isBundledPackagePath(@path) @name = @metadata?.name ? path.basename(@path) @@ -178,8 +178,9 @@ class Package context = 'atom-text-editor' if @metadata.theme is 'syntax' group = @getStylesheetType() + @stylesheetDisposables = new CompositeDisposable for [sourcePath, source] in @stylesheets - @stylesheetDisposables.add(atom.styles.addStyleSheet(source, {sourcePath, sourcePath, context})) + @stylesheetDisposables.add(atom.styles.addStyleSheet(source, {sourcePath, group, context})) @stylesheetsActivated = true activateResources: -> @@ -322,7 +323,7 @@ class Package deactivateResources: -> grammar.deactivate() for grammar in @grammars scopedProperties.deactivate() for scopedProperties in @scopedProperties - atom.themes.removeStylesheet(stylesheetPath) for [stylesheetPath] in @stylesheets + @stylesheetDisposables?.dispose() @activationDisposables?.dispose() @stylesheetsActivated = false @grammarsActivated = false