From 613f72003c02c5dbb4ea38b258fd3599f081f5bc Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Sep 2013 15:48:23 -0700 Subject: [PATCH] Precompile main stylesheet from each theme --- tasks/prebuild-less-task.coffee | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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)