diff --git a/spec/theme-manager-spec.coffee b/spec/theme-manager-spec.coffee index 7d1e2c05b..c788ef4ca 100644 --- a/spec/theme-manager-spec.coffee +++ b/spec/theme-manager-spec.coffee @@ -8,7 +8,9 @@ describe "ThemeManager", -> themeManager = null beforeEach -> - themeManager = new ThemeManager(atom.packages) + themeManager = new ThemeManager + packageManager: atom.packages + resourcePath: window.resourcePath afterEach -> themeManager.deactivateThemes() diff --git a/src/atom.coffee b/src/atom.coffee index 876ce39e2..b6b7b71b2 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -62,7 +62,7 @@ class Atom @packages = new PackageManager({devMode, configDirPath, resourcePath}) @subscribe @packages, 'activated', => @watchThemes() - @themes = new ThemeManager(@packages) + @themes = new ThemeManager({packageManager: @packages, @resourcePath}) @contextMenu = new ContextMenuManager(devMode) @menu = new MenuManager() @pasteboard = new Pasteboard() diff --git a/src/config.coffee b/src/config.coffee index f3f13fe87..64a6e96cb 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -37,10 +37,6 @@ class Config @bundledMenusDirPath = path.join(resourcePath, "menus") @nodeModulesDirPath = path.join(@resourcePath, "node_modules") @bundledPackageDirPaths = [@nodeModulesDirPath] - @lessSearchPaths = [ - path.join(@resourcePath, 'static', 'variables') - path.join(@resourcePath, 'static') - ] @packageDirPaths = [path.join(@configDirPath, "packages")] if atom.getLoadSettings().devMode @packageDirPaths.unshift(path.join(@configDirPath, "dev", "packages")) diff --git a/src/less-compile-cache.coffee b/src/less-compile-cache.coffee index 6828c843b..0236cf391 100644 --- a/src/less-compile-cache.coffee +++ b/src/less-compile-cache.coffee @@ -11,16 +11,21 @@ class LessCompileCache @cacheDir: path.join(tmpDir, 'atom-compile-cache', 'less') - constructor: -> + constructor: ({resourcePath})-> @cache = new LessCache cacheDir: @constructor.cacheDir importPaths: @getImportPaths() resourcePath: window.resourcePath - fallbackDir: path.join(window.resourcePath, 'less-compile-cache') + fallbackDir: path.join(resourcePath, 'less-compile-cache') + + @lessSearchPaths = [ + path.join(resourcePath, 'static', 'variables') + path.join(resourcePath, 'static') + ] @subscribe atom.themes, 'reloaded', => @cache.setImportPaths(@getImportPaths()) - getImportPaths: -> atom.themes.getImportPaths().concat(atom.config.lessSearchPaths) + getImportPaths: -> atom.themes.getImportPaths().concat(@lessSearchPaths) read: (stylesheetPath) -> @cache.readFileSync(stylesheetPath) diff --git a/src/theme-manager.coffee b/src/theme-manager.coffee index 9993cf5aa..b2f592cc1 100644 --- a/src/theme-manager.coffee +++ b/src/theme-manager.coffee @@ -17,7 +17,7 @@ module.exports = class ThemeManager Emitter.includeInto(this) - constructor: (@packageManager) -> + constructor: ({@packageManager, @resourcePath}) -> @lessCache = null @packageManager.registerPackageActivator(this, ['theme']) @@ -148,7 +148,7 @@ class ThemeManager loadLessStylesheet: (lessStylesheetPath) -> unless lessCache? LessCompileCache = require './less-compile-cache' - @lessCache = new LessCompileCache() + @lessCache = new LessCompileCache({@resourcePath}) try @lessCache.read(lessStylesheetPath)