aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2014-03-27 21:28:21 -0700
committerChris Rebert <[email protected]>2014-03-28 11:12:28 -0700
commit07314b5475e9aec63f490c266a011ec0b80cb339 (patch)
treecdb8bae2d27a913cc524b8ed8e3d89eaa3b8b0c6 /docs
parent1853e31a1045bb797cdd730c18cc17cefd3e0eca (diff)
downloadbootstrap-07314b5475e9aec63f490c266a011ec0b80cb339.tar.xz
bootstrap-07314b5475e9aec63f490c266a011ec0b80cb339.zip
enhance customizer to handle transitive Less @import-s
Diffstat (limited to 'docs')
-rw-r--r--docs/assets/js/_src/customizer.js21
1 files changed, 16 insertions, 5 deletions
diff --git a/docs/assets/js/_src/customizer.js b/docs/assets/js/_src/customizer.js
index 596687b09..06338b1ef 100644
--- a/docs/assets/js/_src/customizer.js
+++ b/docs/assets/js/_src/customizer.js
@@ -181,10 +181,20 @@ window.onload = function () { // wait for load in a dumb way because B-0
var IMPORT_REGEX = /^@import \"(.*?)\";$/
var lessLines = __less[lessFilename].split('\n')
- for (var i = 0, imports = []; i < lessLines.length; i++) {
- var match = IMPORT_REGEX.exec(lessLines[i])
- if (match) imports.push(match[1])
- }
+ var imports = []
+ $.each(lessLines, function (index, lessLine) {
+ var match = IMPORT_REGEX.exec(lessLine)
+ if (match) {
+ var importee = match[1]
+ var transitiveImports = includedLessFilenames(importee)
+ $.each(transitiveImports, function (index, transitiveImportee) {
+ if ($.inArray(transitiveImportee, imports) === -1) {
+ imports.push(transitiveImportee)
+ }
+ })
+ imports.push(importee)
+ }
+ })
return imports
}
@@ -192,7 +202,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
function generateLESS(lessFilename, lessFileIncludes, vars) {
var lessSource = __less[lessFilename]
- $.each(includedLessFilenames(lessFilename), function(index, filename) {
+ var lessFilenames = includedLessFilenames(lessFilename)
+ $.each(lessFilenames, function(index, filename) {
var fileInclude = lessFileIncludes[filename]
// Files not explicitly unchecked are compiled into the final stylesheet.