mirror of
https://github.com/atom/atom.git
synced 2026-01-25 06:48:28 -05:00
Merge pull request #6365 from atom/ks-fix-static-less-prebuild-cache
Fix static .less prebuilt cache
This commit is contained in:
@@ -92,6 +92,7 @@ module.exports = (grunt) ->
|
||||
prebuildLessConfig =
|
||||
src: [
|
||||
'static/**/*.less'
|
||||
'node_modules/atom-space-pen-views/stylesheets/**/*.less'
|
||||
]
|
||||
|
||||
csonConfig =
|
||||
|
||||
@@ -20,6 +20,14 @@ module.exports = (grunt) ->
|
||||
rm(bootstrapLessPath)
|
||||
rm(path.join(appDir, 'node_modules', 'bootstrap', 'less'))
|
||||
|
||||
importFallbackVariables = (lessFilePath) ->
|
||||
if lessFilePath.indexOf('static') is 0
|
||||
false
|
||||
else if lessFilePath.indexOf('atom-space-pen-views') isnt -1
|
||||
false
|
||||
else
|
||||
true
|
||||
|
||||
grunt.registerMultiTask 'prebuild-less', 'Prebuild cached of compiled Less files', ->
|
||||
compileBootstrap()
|
||||
|
||||
@@ -82,12 +90,14 @@ module.exports = (grunt) ->
|
||||
importPaths: importPaths
|
||||
|
||||
cssForFile = (file) ->
|
||||
baseVarImports = """
|
||||
@import "variables/ui-variables";
|
||||
@import "variables/syntax-variables";
|
||||
"""
|
||||
less = fs.readFileSync(file, 'utf8')
|
||||
lessCache.cssForFile(file, [baseVarImports, less].join('\n'))
|
||||
if importFallbackVariables(file)
|
||||
baseVarImports = """
|
||||
@import "variables/ui-variables";
|
||||
@import "variables/syntax-variables";
|
||||
"""
|
||||
less = [baseVarImports, less].join('\n')
|
||||
lessCache.cssForFile(file, less)
|
||||
|
||||
for file in @filesSrc
|
||||
grunt.verbose.writeln("File #{file.cyan} created in cache.")
|
||||
|
||||
Reference in New Issue
Block a user