Skip to content

Commit

Permalink
Customizer: include config.json in bootstrap.zip
Browse files Browse the repository at this point in the history
merges #10633; fixes part of #9951
  • Loading branch information
stuartpb authored and cvrebert committed Oct 10, 2013
1 parent d820c6d commit 58a47b6
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions docs-assets/js/customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ window.onload = function () { // wait for load in a dumb way because B-0
return match && decodeURIComponent(match[1].replace(/\+/g, " "));
}

function createGist(configData) {
function createGist(configJson) {
var data = {
"description": "Bootstrap Customizer Config",
"public": true,
"files": {
"config.json": {
"content": JSON.stringify(configData, null, 2)
"content": configJson
}
}
}
Expand Down Expand Up @@ -107,7 +107,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
})
}

function generateZip(css, js, fonts, complete) {
function generateZip(css, js, fonts, config, complete) {
if (!css && !js) return showError('<strong>Ruh roh!</strong> No Bootstrap files selected.', new Error('no Bootstrap'))

var zip = new JSZip()
Expand All @@ -133,6 +133,10 @@ window.onload = function () { // wait for load in a dumb way because B-0
}
}

if (config) {
zip.file('config.json', config)
}

var content = zip.generate({type:"blob"})

complete(content)
Expand Down Expand Up @@ -262,14 +266,17 @@ window.onload = function () { // wait for load in a dumb way because B-0
var $downloadBtn = $('#btn-download')

$compileBtn.on('click', function (e) {
var configData = getCustomizerData()
var configJson = JSON.stringify(configData, null, 2)

e.preventDefault()

$compileBtn.attr('disabled', 'disabled')

generateZip(generateCSS(), generateJavascript(), generateFonts(), function (blob) {
generateZip(generateCSS(), generateJavascript(), generateFonts(), configJson, function (blob) {
$compileBtn.removeAttr('disabled')
saveAs(blob, "bootstrap.zip")
createGist(getCustomizerData())
createGist(configJson)
})
})

Expand Down

0 comments on commit 58a47b6

Please sign in to comment.