mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-30 22:52:24 +01:00
Use autoprefixer for Customizer builds
This commit is contained in:
parent
9dea306097
commit
1582039193
@ -6,7 +6,7 @@
|
|||||||
* details, see http://creativecommons.org/licenses/by/3.0/.
|
* details, see http://creativecommons.org/licenses/by/3.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global JSZip, less, saveAs, UglifyJS, __configBridge, __js, __less, __fonts */
|
/* global JSZip, less, autoprefixer, saveAs, UglifyJS, __configBridge, __js, __less, __fonts */
|
||||||
|
|
||||||
window.onload = function () { // wait for load in a dumb way because B-0
|
window.onload = function () { // wait for load in a dumb way because B-0
|
||||||
'use strict';
|
'use strict';
|
||||||
@ -251,6 +251,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
|
|||||||
}
|
}
|
||||||
|
|
||||||
function compileLESS(lessSource, baseFilename, intoResult) {
|
function compileLESS(lessSource, baseFilename, intoResult) {
|
||||||
|
var promise = $.Deferred()
|
||||||
var parser = new less.Parser({
|
var parser = new less.Parser({
|
||||||
paths: ['variables.less', 'mixins.less'],
|
paths: ['variables.less', 'mixins.less'],
|
||||||
optimization: 0,
|
optimization: 0,
|
||||||
@ -259,14 +260,18 @@ window.onload = function () { // wait for load in a dumb way because B-0
|
|||||||
|
|
||||||
parser.parse(lessSource, function (err, tree) {
|
parser.parse(lessSource, function (err, tree) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return showError('<strong>Ruh roh!</strong> Could not parse less files.', err)
|
return promise.reject(err)
|
||||||
}
|
}
|
||||||
intoResult[baseFilename + '.css'] = cw + tree.toCSS()
|
intoResult[baseFilename + '.css'] = cw + tree.toCSS()
|
||||||
intoResult[baseFilename + '.min.css'] = cw + tree.toCSS({ compress: true })
|
intoResult[baseFilename + '.min.css'] = cw + tree.toCSS({ compress: true })
|
||||||
|
promise.resolve()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return promise.promise()
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateCSS(preamble) {
|
function generateCSS(preamble) {
|
||||||
|
var promise = $.Deferred()
|
||||||
var oneChecked = false
|
var oneChecked = false
|
||||||
var lessFileIncludes = {}
|
var lessFileIncludes = {}
|
||||||
$('#less-section input').each(function () {
|
$('#less-section input').each(function () {
|
||||||
@ -290,14 +295,22 @@ window.onload = function () { // wait for load in a dumb way because B-0
|
|||||||
var bsLessSource = preamble + generateLESS('bootstrap.less', lessFileIncludes, vars)
|
var bsLessSource = preamble + generateLESS('bootstrap.less', lessFileIncludes, vars)
|
||||||
var themeLessSource = preamble + generateLESS('theme.less', lessFileIncludes, vars)
|
var themeLessSource = preamble + generateLESS('theme.less', lessFileIncludes, vars)
|
||||||
|
|
||||||
try {
|
var prefixer = autoprefixer({ browsers: __configBridge.autoprefixerBrowsers })
|
||||||
compileLESS(bsLessSource, 'bootstrap', result)
|
|
||||||
compileLESS(themeLessSource, 'bootstrap-theme', result)
|
|
||||||
} catch (err) {
|
|
||||||
return showError('<strong>Ruh roh!</strong> Could not parse less files.', err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
$.when(
|
||||||
|
compileLESS(bsLessSource, 'bootstrap', result),
|
||||||
|
compileLESS(themeLessSource, 'bootstrap-theme', result)
|
||||||
|
).done(function () {
|
||||||
|
for (var key in result) {
|
||||||
|
result[key] = prefixer.process(result[key]).css
|
||||||
|
}
|
||||||
|
promise.resolve(result)
|
||||||
|
}).fail(function (err) {
|
||||||
|
showError('<strong>Ruh roh!</strong> Could not parse less files.', err)
|
||||||
|
promise.reject()
|
||||||
|
})
|
||||||
|
|
||||||
|
return promise.promise()
|
||||||
}
|
}
|
||||||
|
|
||||||
function uglify(js) {
|
function uglify(js) {
|
||||||
@ -453,9 +466,15 @@ window.onload = function () { // wait for load in a dumb way because B-0
|
|||||||
' * Config saved to config.json and ' + gistUrl + '\n' +
|
' * Config saved to config.json and ' + gistUrl + '\n' +
|
||||||
' */\n'
|
' */\n'
|
||||||
|
|
||||||
generateZip(generateCSS(preamble), generateJS(preamble), generateFonts(), configJson, function (blob) {
|
$.when(
|
||||||
$compileBtn.removeAttr('disabled')
|
generateCSS(preamble),
|
||||||
setTimeout(function () { saveAs(blob, 'bootstrap.zip') }, 0)
|
generateJS(preamble),
|
||||||
|
generateFonts()
|
||||||
|
).done(function (css, js, fonts) {
|
||||||
|
generateZip(css, js, fonts, configJson, function (blob) {
|
||||||
|
$compileBtn.removeAttr('disabled')
|
||||||
|
setTimeout(function () { saveAs(blob, 'bootstrap.zip') }, 0)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
16015
docs/assets/js/vendor/autoprefixer.js
vendored
Normal file
16015
docs/assets/js/vendor/autoprefixer.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user