Skip to content

Commit

Permalink
Fixed customizer. Fixes #233
Browse files Browse the repository at this point in the history
Bump version to 3.1.3
  • Loading branch information
jasny committed May 6, 2014
1 parent 1e90ae4 commit 73f8061
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 25 deletions.
10 changes: 5 additions & 5 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ exclude:
- "vendor"

# Custom vars
current_version: 3.1.2
current_version: 3.1.3
repo: https://github.com/jasny/bootstrap

download:
source: https://github.com/jasny/bootstrap/archive/v3.1.2.zip
dist: https://github.com/jasny/bootstrap/releases/download/v3.1.2/jasny-bootstrap-3.1.2-dist.zip
source: https://github.com/jasny/bootstrap/archive/v3.1.3.zip
dist: https://github.com/jasny/bootstrap/releases/download/v3.1.3/jasny-bootstrap-3.1.3-dist.zip

cdn:
css: //cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/3.1.2/css/jasny-bootstrap.min.css
js: //cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/3.1.2/js/jasny-bootstrap.min.js
css: //cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/3.1.3/css/jasny-bootstrap.min.css
js: //cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/3.1.3/js/jasny-bootstrap.min.js
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jasny-bootstrap",
"version": "3.1.2",
"version": "3.1.3",
"main": [
"./dist/css/jasny-bootstrap.css",
"./dist/js/jasny-bootstrap.js"
Expand Down
13 changes: 9 additions & 4 deletions docs/assets/js/customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,14 @@ window.onload = function () { // wait for load in a dumb way because B-0
return imports
}

function generateLESS(lessFilename, lessFileIncludes, vars) {
function generateLESS(lessFilename, lessFileIncludes, vars, additionalLessFiles) {
var lessSource = __less[lessFilename]

// Additional imports files, not present in less file, but required to build
$.each(additionalLessFiles || [], function(index, filename) {
lessSource += __less[filename]
})

$.each(includedLessFilenames(lessFilename), function(index, filename) {
var fileInclude = lessFileIncludes[filename]

Expand All @@ -197,7 +202,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 (('build/default-variables.less' === filename) && vars) lessSource += generateCustomCSS(vars)
if (('variables.less' === filename) && vars) lessSource += generateCustomCSS(vars)
})

lessSource = lessSource.replace(/@import[^\n]*/gi, '') //strip any imports
Expand All @@ -206,7 +211,6 @@ window.onload = function () { // wait for load in a dumb way because B-0

function compileLESS(lessSource, baseFilename, intoResult) {
var parser = new less.Parser({
paths: ['build/default-variables.less', 'mixins.less'],
optimization: 0,
filename: baseFilename + '.css'
}).parse(lessSource, function (err, tree) {
Expand Down Expand Up @@ -239,7 +243,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
$(this).val() && (vars[$(this).prev().text()] = $(this).val())
})

var bsLessSource = generateLESS('jasny-bootstrap.less', lessFileIncludes, vars)
var bsLessSource = generateLESS('jasny-bootstrap.less', lessFileIncludes, vars,
['build/variables.less', 'build/mixins.less'])

try {
compileLESS(bsLessSource, 'jasny-bootstrap', result)
Expand Down
25 changes: 15 additions & 10 deletions grunt/bs-raw-files-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,28 @@
var btoa = require('btoa');
var fs = require('fs');

function getFiles(type) {
function getFiles(type, subdirs, exclude) {
var files = {};
fs.readdirSync(type)
.filter(function (path) {
return new RegExp('\\.' + type + '$').test(path);
})
.forEach(function (path) {
var fullPath = type + (path === 'variables.less' ? '/build/' : '/') + path;
files[path] = fs.readFileSync(fullPath, 'utf8');
});
if (!exclude) exclude = [];

subdirs.forEach(function(subdir) {
var sub = subdir ? subdir + '/' : '';
fs.readdirSync(type + '/' + sub)
.filter(function (path) {
return new RegExp('\\.' + type + '$').test(path) && exclude.indexOf(sub + path) === -1;
})
.forEach(function (path) {
var fullPath = type + '/' + sub + path;
files[sub + path] = fs.readFileSync(fullPath, 'utf8');
});
});
return 'var __' + type + ' = ' + JSON.stringify(files) + '\n';
}

module.exports = function generateRawFilesJs(banner) {
if (!banner) {
banner = '';
}
var files = banner + getFiles('js') + getFiles('less');
var files = banner + getFiles('js', ['']) + getFiles('less', ['', 'build'], ['build/jasny-bootstrap.less']);
fs.writeFileSync('docs/assets/js/raw-files.min.js', files);
};
2 changes: 1 addition & 1 deletion js/fileinput.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ===========================================================
* Bootstrap: fileinput.js v3.1.2
* Bootstrap: fileinput.js v3.1.3
* http://jasny.github.com/bootstrap/javascript/#fileinput
* ===========================================================
* Copyright 2012-2014 Arnold Daniels
Expand Down
2 changes: 1 addition & 1 deletion js/offcanvas.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ========================================================================
* Bootstrap: offcanvas.js v3.1.2
* Bootstrap: offcanvas.js v3.1.3
* http://jasny.github.io/bootstrap/javascript/#offcanvas
* ========================================================================
* Copyright 2013-2014 Arnold Daniels
Expand Down
2 changes: 1 addition & 1 deletion js/rowlink.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ============================================================
* Bootstrap: rowlink.js v3.1.2
* Bootstrap: rowlink.js v3.1.3
* http://jasny.github.io/bootstrap/javascript/#rowlink
* ============================================================
* Copyright 2012-2014 Arnold Daniels
Expand Down
2 changes: 1 addition & 1 deletion js/transition.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ========================================================================
* Bootstrap: transition.js v3.1.2
* Bootstrap: transition.js v3.1.3
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jasny-bootstrap",
"description": "Additional features and components for Bootstrap",
"version": "3.1.2",
"version": "3.1.3",
"keywords": [
"bootstrap",
"css"
Expand Down

0 comments on commit 73f8061

Please sign in to comment.