Mailspring/src/less-compile-cache.coffee
Evan Morikawa f56dc18690 feat(spec): add config dir to integration specs
Summary:
- You can now pass `--config-dir-path=/some/custom/path` to `./N1.sh`
- `main.coffee` cleaned up a bit. A lot of unused params from legacy Atom
  stuff were still being used
- Integration specs now set the config dir before booting.
- New spec to check for the autoupdater in the app and make sure it's
  pointing at the right place.

Test Plan: script/grunt run-integration-tests

Reviewers: juan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2331
2015-12-10 10:52:20 -05:00

32 lines
967 B
CoffeeScript

path = require 'path'
LessCache = require 'less-cache'
# {LessCache} wrapper used by {ThemeManager} to read stylesheets.
module.exports =
class LessCompileCache
constructor: ({configDirPath, resourcePath, importPaths}) ->
@lessSearchPaths = [
path.join(resourcePath, 'static', 'variables')
path.join(resourcePath, 'static')
]
if importPaths?
importPaths = importPaths.concat(@lessSearchPaths)
else
importPaths = @lessSearchPaths
@cache = new LessCache
cacheDir: path.join(configDirPath, 'compile-cache', 'less')
importPaths: importPaths
resourcePath: resourcePath
fallbackDir: path.join(resourcePath, 'less-compile-cache')
setImportPaths: (importPaths=[]) ->
@cache.setImportPaths(importPaths.concat(@lessSearchPaths))
read: (stylesheetPath) ->
@cache.readFileSync(stylesheetPath)
cssForFile: (stylesheetPath, lessContent) ->
@cache.cssForFile(stylesheetPath, lessContent)