Precompile main stylesheet from each theme

This commit is contained in:
Kevin Sawicki
2013-09-16 15:48:23 -07:00
parent 92c2da30cc
commit 613f72003c

View File

@@ -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)