diff options
| author | Chris Rebert <[email protected]> | 2014-03-28 11:42:04 -0700 |
|---|---|---|
| committer | Chris Rebert <[email protected]> | 2014-03-28 11:42:04 -0700 |
| commit | d178a9581be35ff9a5f7eda9e06e5431802f6005 (patch) | |
| tree | 338dae53b5894e510da9204a8032a1af1da7093c /docs/assets/js/_src | |
| parent | 44d32ed776e9c6c8a27e4f108b9f3cd7c87160dd (diff) | |
| parent | b5ae8f9722c0f4a5493e5fb81a53b6dd19d6fdd6 (diff) | |
| download | bootstrap-d178a9581be35ff9a5f7eda9e06e5431802f6005.tar.xz bootstrap-d178a9581be35ff9a5f7eda9e06e5431802f6005.zip | |
Merge pull request #13047 from twbs/fix-customizer
Fix customizer (see #13043)
Diffstat (limited to 'docs/assets/js/_src')
| -rw-r--r-- | docs/assets/js/_src/customizer.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/docs/assets/js/_src/customizer.js b/docs/assets/js/_src/customizer.js index ea7cf7f6f..06338b1ef 100644 --- a/docs/assets/js/_src/customizer.js +++ b/docs/assets/js/_src/customizer.js @@ -158,7 +158,7 @@ window.onload = function () { // wait for load in a dumb way because B-0 complete(content) } - function generateCustomCSS(vars) { + function generateCustomLess(vars) { var result = '' for (var key in vars) { @@ -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. @@ -203,7 +214,7 @@ window.onload = function () { // wait for load in a dumb way because B-0 // Custom variables are added after Bootstrap variables so the custom // ones take precedence. - if (('variables.less' === filename) && vars) lessSource += generateCustomCSS(vars) + if (('variables.less' === filename) && vars) lessSource += generateCustomLess(vars) }) lessSource = lessSource.replace(/@import[^\n]*/gi, '') //strip any imports |
