Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
5458134f
Commit
5458134f
authored
11 years ago
by
Chris Rebert
Browse files
Options
Download
Email Patches
Plain Diff
Add Gist & Customizer URLs to customized files & config.json
Fixes
#9951
Fixes
#12865
parent
440cedee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Gruntfile.js
+3
-0
Gruntfile.js
docs/assets/js/_src/customizer.js
+24
-12
docs/assets/js/_src/customizer.js
with
27 additions
and
12 deletions
+27
-12
Gruntfile.js
+
3
-
0
View file @
5458134f
...
@@ -78,6 +78,9 @@ module.exports = function (grunt) {
...
@@ -78,6 +78,9 @@ module.exports = function (grunt) {
src
:
'
<%= jshint.test.src %>
'
src
:
'
<%= jshint.test.src %>
'
},
},
assets
:
{
assets
:
{
options
:
{
requireCamelCaseOrUpperCaseIdentifiers
:
null
},
src
:
'
<%= jshint.assets.src %>
'
src
:
'
<%= jshint.assets.src %>
'
}
}
},
},
...
...
This diff is collapsed.
Click to expand it.
docs/assets/js/_src/customizer.js
+
24
-
12
View file @
5458134f
...
@@ -43,7 +43,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
...
@@ -43,7 +43,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
return
match
&&
decodeURIComponent
(
match
[
1
].
replace
(
/
\+
/g
,
'
'
))
return
match
&&
decodeURIComponent
(
match
[
1
].
replace
(
/
\+
/g
,
'
'
))
}
}
function
createGist
(
configJson
)
{
function
createGist
(
configJson
,
callback
)
{
var
data
=
{
var
data
=
{
description
:
'
Bootstrap Customizer Config
'
,
description
:
'
Bootstrap Customizer Config
'
,
'
public
'
:
true
,
'
public
'
:
true
,
...
@@ -61,10 +61,13 @@ window.onload = function () { // wait for load in a dumb way because B-0
...
@@ -61,10 +61,13 @@ window.onload = function () { // wait for load in a dumb way because B-0
})
})
.
success
(
function
(
result
)
{
.
success
(
function
(
result
)
{
var
origin
=
window
.
location
.
protocol
+
'
//
'
+
window
.
location
.
host
var
origin
=
window
.
location
.
protocol
+
'
//
'
+
window
.
location
.
host
history
.
replaceState
(
false
,
document
.
title
,
origin
+
window
.
location
.
pathname
+
'
?id=
'
+
result
.
id
)
var
newUrl
=
origin
+
window
.
location
.
pathname
+
'
?id=
'
+
result
.
id
history
.
replaceState
(
false
,
document
.
title
,
newUrl
)
callback
(
result
.
html_url
,
newUrl
)
})
})
.
error
(
function
(
err
)
{
.
error
(
function
(
err
)
{
showError
(
'
<strong>Ruh roh!</strong> Could not save gist file, configuration not saved.
'
,
err
)
showError
(
'
<strong>Ruh roh!</strong> Could not save gist file, configuration not saved.
'
,
err
)
callback
(
'
<none>
'
,
'
<none>
'
)
})
})
}
}
...
@@ -221,7 +224,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
...
@@ -221,7 +224,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
})
})
}
}
function
generateCSS
()
{
function
generateCSS
(
preamble
)
{
var
oneChecked
=
false
var
oneChecked
=
false
var
lessFileIncludes
=
{}
var
lessFileIncludes
=
{}
$
(
'
#less-section input
'
).
each
(
function
()
{
$
(
'
#less-section input
'
).
each
(
function
()
{
...
@@ -242,8 +245,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
...
@@ -242,8 +245,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
$
(
this
).
val
()
&&
(
vars
[
$
(
this
).
prev
().
text
()]
=
$
(
this
).
val
())
$
(
this
).
val
()
&&
(
vars
[
$
(
this
).
prev
().
text
()]
=
$
(
this
).
val
())
})
})
var
bsLessSource
=
generateLESS
(
'
bootstrap.less
'
,
lessFileIncludes
,
vars
)
var
bsLessSource
=
preamble
+
generateLESS
(
'
bootstrap.less
'
,
lessFileIncludes
,
vars
)
var
themeLessSource
=
generateLESS
(
'
theme.less
'
,
lessFileIncludes
,
vars
)
var
themeLessSource
=
preamble
+
generateLESS
(
'
theme.less
'
,
lessFileIncludes
,
vars
)
try
{
try
{
compileLESS
(
bsLessSource
,
'
bootstrap
'
,
result
)
compileLESS
(
bsLessSource
,
'
bootstrap
'
,
result
)
...
@@ -255,7 +258,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
...
@@ -255,7 +258,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
return
result
return
result
}
}
function
generateJavascript
()
{
function
generateJavascript
(
preamble
)
{
var
$checked
=
$
(
'
#plugin-section input:checked
'
)
var
$checked
=
$
(
'
#plugin-section input:checked
'
)
if
(
!
$checked
.
length
)
return
false
if
(
!
$checked
.
length
)
return
false
...
@@ -265,8 +268,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
...
@@ -265,8 +268,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
.
join
(
'
\n
'
)
.
join
(
'
\n
'
)
return
{
return
{
'
bootstrap.js
'
:
js
,
'
bootstrap.js
'
:
preamble
+
js
,
'
bootstrap.min.js
'
:
cw
+
uglify
(
js
)
'
bootstrap.min.js
'
:
preamble
+
cw
+
uglify
(
js
)
}
}
}
}
...
@@ -322,10 +325,19 @@ window.onload = function () { // wait for load in a dumb way because B-0
...
@@ -322,10 +325,19 @@ window.onload = function () { // wait for load in a dumb way because B-0
$compileBtn
.
attr
(
'
disabled
'
,
'
disabled
'
)
$compileBtn
.
attr
(
'
disabled
'
,
'
disabled
'
)
generateZip
(
generateCSS
(),
generateJavascript
(),
generateFonts
(),
configJson
,
function
(
blob
)
{
createGist
(
configJson
,
function
(
gistUrl
,
customizerUrl
)
{
$compileBtn
.
removeAttr
(
'
disabled
'
)
configData
.
customizerUrl
=
customizerUrl
saveAs
(
blob
,
'
bootstrap.zip
'
)
configJson
=
JSON
.
stringify
(
configData
,
null
,
2
)
createGist
(
configJson
)
var
preamble
=
'
/*!
\n
'
+
'
* Generated using the Bootstrap Customizer (
'
+
customizerUrl
+
'
)
\n
'
+
'
* Config saved to config.json and
'
+
gistUrl
+
'
\n
'
+
'
*/
\n
'
generateZip
(
generateCSS
(
preamble
),
generateJavascript
(
preamble
),
generateFonts
(),
configJson
,
function
(
blob
)
{
$compileBtn
.
removeAttr
(
'
disabled
'
)
saveAs
(
blob
,
'
bootstrap.zip
'
)
})
})
})
});
});
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment