mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-21 12:51:52 +02:00
Merge branch '3.0.0-wip' of github.com:twbs/bootstrap into 3.0.0-wip
This commit is contained in:
@@ -169,7 +169,7 @@ module.exports = function(grunt) {
|
|||||||
grunt.registerTask('validate-html', ['jekyll', 'validation']);
|
grunt.registerTask('validate-html', ['jekyll', 'validation']);
|
||||||
|
|
||||||
// Test task.
|
// Test task.
|
||||||
var testSubtasks = ['dist-css', 'jshint', 'qunit', 'validate-html'];
|
var testSubtasks = ['dist-css', 'jshint', 'qunit'];
|
||||||
// Only run BrowserStack tests under Travis
|
// Only run BrowserStack tests under Travis
|
||||||
if (process.env.TRAVIS) {
|
if (process.env.TRAVIS) {
|
||||||
// Only run BrowserStack tests if this is a mainline commit in twbs/bootstrap, or you have your own BrowserStack key
|
// Only run BrowserStack tests if this is a mainline commit in twbs/bootstrap, or you have your own BrowserStack key
|
||||||
@@ -202,7 +202,7 @@ module.exports = function(grunt) {
|
|||||||
var files = {}
|
var files = {}
|
||||||
fs.readdirSync(type)
|
fs.readdirSync(type)
|
||||||
.filter(function (path) {
|
.filter(function (path) {
|
||||||
return new RegExp('\\.' + type + '$').test(path)
|
return type == 'fonts' ? true : new RegExp('\\.' + type + '$').test(path)
|
||||||
})
|
})
|
||||||
.forEach(function (path) {
|
.forEach(function (path) {
|
||||||
return files[path] = fs.readFileSync(type + '/' + path, 'utf8')
|
return files[path] = fs.readFileSync(type + '/' + path, 'utf8')
|
||||||
@@ -211,7 +211,7 @@ module.exports = function(grunt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var customize = fs.readFileSync('customize.html', 'utf-8')
|
var customize = fs.readFileSync('customize.html', 'utf-8')
|
||||||
var files = '<!-- generated -->\n<script id="files">\n' + getFiles('js') + getFiles('less') + '<\/script>\n<!-- /generated -->'
|
var files = '<!-- generated -->\n<script id="files">\n' + getFiles('js') + getFiles('less') + getFiles('fonts') + '<\/script>\n<!-- /generated -->'
|
||||||
fs.writeFileSync('customize.html', customize.replace(/<!-- generated -->(.|[\n\r])*<!-- \/generated -->/, files))
|
fs.writeFileSync('customize.html', customize.replace(/<!-- generated -->(.|[\n\r])*<!-- \/generated -->/, '') + files)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@@ -107,7 +107,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateZip(css, js, complete) {
|
function generateZip(css, js, fonts, complete) {
|
||||||
if (!css && !js) return showError('<strong>Ruh roh!</strong> No Bootstrap files selected.', new Error('no Bootstrap'))
|
if (!css && !js) return showError('<strong>Ruh roh!</strong> No Bootstrap files selected.', new Error('no Bootstrap'))
|
||||||
|
|
||||||
var zip = new JSZip()
|
var zip = new JSZip()
|
||||||
@@ -126,6 +126,13 @@ window.onload = function () { // wait for load in a dumb way because B-0
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fonts) {
|
||||||
|
var fontsFolder = zip.folder('fonts')
|
||||||
|
for (var fileName in fonts) {
|
||||||
|
fontsFolder.file(fileName, fonts[fileName])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var content = zip.generate({type:"blob"})
|
var content = zip.generate({type:"blob"})
|
||||||
|
|
||||||
complete(content)
|
complete(content)
|
||||||
@@ -141,6 +148,13 @@ window.onload = function () { // wait for load in a dumb way because B-0
|
|||||||
return result + '\n\n'
|
return result + '\n\n'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateFonts() {
|
||||||
|
var glyphicons = $('#less-section [value="glyphicons.less"]:checked')
|
||||||
|
if (glyphicons.length) {
|
||||||
|
return __fonts
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function generateCSS() {
|
function generateCSS() {
|
||||||
var $checked = $('#less-section input:checked')
|
var $checked = $('#less-section input:checked')
|
||||||
|
|
||||||
@@ -252,7 +266,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
|
|||||||
|
|
||||||
$compileBtn.attr('disabled', 'disabled')
|
$compileBtn.attr('disabled', 'disabled')
|
||||||
|
|
||||||
generateZip(generateCSS(), generateJavascript(), function (blob) {
|
generateZip(generateCSS(), generateJavascript(), generateFonts(), function (blob) {
|
||||||
$compileBtn.removeAttr('disabled')
|
$compileBtn.removeAttr('disabled')
|
||||||
saveAs(blob, "bootstrap.zip")
|
saveAs(blob, "bootstrap.zip")
|
||||||
createGist(getCustomizerData())
|
createGist(getCustomizerData())
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user