@@ -3,6 +3,7 @@ _ = require 'underscore-plus'
3
3
{Emitter , CompositeDisposable } = require ' event-kit'
4
4
{File } = require ' pathwatcher'
5
5
fs = require ' fs-plus'
6
+ LessCompileCache = require ' ./less-compile-cache'
6
7
7
8
# Extended: Handles loading and activating available themes.
8
9
#
@@ -18,16 +19,15 @@ class ThemeManager
18
19
@packageManager .onDidActivateInitialPackages =>
19
20
@ onDidChangeActiveThemes => @packageManager .reloadActivePackageStyleSheets ()
20
21
22
+ initialize : ({@resourcePath , @configDirPath , @safeMode , devMode}) ->
21
23
@lessSourcesByRelativeFilePath = null
22
- if typeof snapshotAuxiliaryData is ' undefined'
24
+ if devMode or typeof snapshotAuxiliaryData is ' undefined'
23
25
@lessSourcesByRelativeFilePath = {}
24
26
@importedFilePathsByRelativeImportPath = {}
25
27
else
26
28
@lessSourcesByRelativeFilePath = snapshotAuxiliaryData .lessSourcesByRelativeFilePath
27
29
@importedFilePathsByRelativeImportPath = snapshotAuxiliaryData .importedFilePathsByRelativeImportPath
28
30
29
- initialize : ({@resourcePath , @configDirPath , @safeMode }) ->
30
-
31
31
###
32
32
Section: Event Subscription
33
33
###
@@ -202,14 +202,12 @@ class ThemeManager
202
202
fs .readFileSync (stylesheetPath, ' utf8' )
203
203
204
204
loadLessStylesheet : (lessStylesheetPath , importFallbackVariables = false ) ->
205
- unless @lessCache ?
206
- LessCompileCache = require ' ./less-compile-cache'
207
- @lessCache = new LessCompileCache ({
208
- @resourcePath ,
209
- @lessSourcesByRelativeFilePath ,
210
- @importedFilePathsByRelativeImportPath ,
211
- importPaths : @ getImportPaths ()
212
- })
205
+ @lessCache ?= new LessCompileCache ({
206
+ @resourcePath ,
207
+ @lessSourcesByRelativeFilePath ,
208
+ @importedFilePathsByRelativeImportPath ,
209
+ importPaths : @ getImportPaths ()
210
+ })
213
211
214
212
try
215
213
if importFallbackVariables
0 commit comments