mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
💉 resource path into LessCompileCache
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user