mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Don't use cached less sources and imported files in dev mode
This commit is contained in:
@@ -232,7 +232,7 @@ class AtomEnvironment extends Model
|
||||
|
||||
@styles.initialize({@configDirPath})
|
||||
@packages.initialize({devMode, @configDirPath, resourcePath, safeMode})
|
||||
@themes.initialize({@configDirPath, resourcePath, safeMode})
|
||||
@themes.initialize({@configDirPath, resourcePath, safeMode, devMode})
|
||||
|
||||
@commandInstaller.initialize(@getVersion())
|
||||
@workspace.initialize()
|
||||
|
||||
@@ -4,9 +4,9 @@ LessCache = require 'less-cache'
|
||||
# {LessCache} wrapper used by {ThemeManager} to read stylesheets.
|
||||
module.exports =
|
||||
class LessCompileCache
|
||||
@cacheDir: path.join(process.env.ATOM_HOME, 'compile-cache', 'less')
|
||||
|
||||
constructor: ({resourcePath, importPaths, lessSourcesByRelativeFilePath, importedFilePathsByRelativeImportPath}) ->
|
||||
cacheDir = path.join(process.env.ATOM_HOME, 'compile-cache', 'less')
|
||||
|
||||
@lessSearchPaths = [
|
||||
path.join(resourcePath, 'static', 'variables')
|
||||
path.join(resourcePath, 'static')
|
||||
@@ -22,7 +22,7 @@ class LessCompileCache
|
||||
resourcePath,
|
||||
lessSourcesByRelativeFilePath,
|
||||
importedFilePathsByRelativeImportPath,
|
||||
cacheDir: @constructor.cacheDir,
|
||||
cacheDir,
|
||||
fallbackDir: path.join(resourcePath, 'less-compile-cache')
|
||||
})
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ _ = require 'underscore-plus'
|
||||
{Emitter, CompositeDisposable} = require 'event-kit'
|
||||
{File} = require 'pathwatcher'
|
||||
fs = require 'fs-plus'
|
||||
LessCompileCache = require './less-compile-cache'
|
||||
|
||||
# Extended: Handles loading and activating available themes.
|
||||
#
|
||||
@@ -18,16 +19,15 @@ class ThemeManager
|
||||
@packageManager.onDidActivateInitialPackages =>
|
||||
@onDidChangeActiveThemes => @packageManager.reloadActivePackageStyleSheets()
|
||||
|
||||
initialize: ({@resourcePath, @configDirPath, @safeMode, devMode}) ->
|
||||
@lessSourcesByRelativeFilePath = null
|
||||
if typeof snapshotAuxiliaryData is 'undefined'
|
||||
if devMode or typeof snapshotAuxiliaryData is 'undefined'
|
||||
@lessSourcesByRelativeFilePath = {}
|
||||
@importedFilePathsByRelativeImportPath = {}
|
||||
else
|
||||
@lessSourcesByRelativeFilePath = snapshotAuxiliaryData.lessSourcesByRelativeFilePath
|
||||
@importedFilePathsByRelativeImportPath = snapshotAuxiliaryData.importedFilePathsByRelativeImportPath
|
||||
|
||||
initialize: ({@resourcePath, @configDirPath, @safeMode}) ->
|
||||
|
||||
###
|
||||
Section: Event Subscription
|
||||
###
|
||||
@@ -202,14 +202,12 @@ class ThemeManager
|
||||
fs.readFileSync(stylesheetPath, 'utf8')
|
||||
|
||||
loadLessStylesheet: (lessStylesheetPath, importFallbackVariables=false) ->
|
||||
unless @lessCache?
|
||||
LessCompileCache = require './less-compile-cache'
|
||||
@lessCache = new LessCompileCache({
|
||||
@resourcePath,
|
||||
@lessSourcesByRelativeFilePath,
|
||||
@importedFilePathsByRelativeImportPath,
|
||||
importPaths: @getImportPaths()
|
||||
})
|
||||
@lessCache ?= new LessCompileCache({
|
||||
@resourcePath,
|
||||
@lessSourcesByRelativeFilePath,
|
||||
@importedFilePathsByRelativeImportPath,
|
||||
importPaths: @getImportPaths()
|
||||
})
|
||||
|
||||
try
|
||||
if importFallbackVariables
|
||||
|
||||
Reference in New Issue
Block a user