diff --git a/tasks/prebuild-less-task.coffee b/tasks/prebuild-less-task.coffee index db9c0ec44..84c365bd1 100644 --- a/tasks/prebuild-less-task.coffee +++ b/tasks/prebuild-less-task.coffee @@ -19,10 +19,16 @@ module.exports = (grunt) -> path.resolve('static') path.resolve('vendor') ] + themeMains = [] for theme in configuration # TODO Use AtomPackage class once it runs outside of an Atom context - themePath = path.resolve('node_modules', theme, 'stylesheets') - importPaths.unshift(themePath) if grunt.file.isDir(themePath) + themePath = path.resolve('node_modules', theme) + stylesheetsDir = path.join(themePath, 'stylesheets') + {main} = grunt.file.readJSON(path.join(themePath, 'package.json')) + main ?= 'index.less' + mainPath = path.join(themePath, main) + themeMains.push(mainPath) if grunt.file.isFile(mainPath) + importPaths.unshift(stylesheetsDir) if grunt.file.isDir(stylesheetsDir) grunt.log.writeln("Building LESS cache for #{configuration.join(', ').yellow}") lessCache = new LessCache @@ -33,3 +39,7 @@ module.exports = (grunt) -> for file in @filesSrc grunt.log.writeln("File #{file.cyan} created in cache.") lessCache.readFileSync(file) + + for file in themeMains + grunt.log.writeln("File #{file.cyan} created in cache.") + lessCache.readFileSync(file)