mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-11 18:02:28 +03:00
Use JS & Jade to generate the customizer variables form HTML from variables.less; fixes #11095
also updates variables file organization (courtesy @mdo)
This commit is contained in:
+29
-2
@@ -10,9 +10,11 @@ module.exports = function (grunt) {
|
||||
return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||
}
|
||||
|
||||
var BsLessdocParser = require('./docs/grunt/bs-lessdoc-parser.js')
|
||||
var fs = require('fs')
|
||||
var generateGlyphiconsData = require('./docs/grunt/bs-glyphicons-data-generator.js')
|
||||
var generateRawFilesJs = require('./docs/grunt/bs-raw-files-generator.js')
|
||||
var path = require('path')
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
@@ -46,6 +48,9 @@ module.exports = function (grunt) {
|
||||
},
|
||||
assets: {
|
||||
src: ['docs/assets/js/application.js', 'docs/assets/js/customizer.js']
|
||||
},
|
||||
docsGrunt: {
|
||||
src: ['docs/grunt/*.js']
|
||||
}
|
||||
},
|
||||
|
||||
@@ -64,6 +69,9 @@ module.exports = function (grunt) {
|
||||
},
|
||||
assets: {
|
||||
src: ['docs/assets/js/application.js', 'docs/assets/js/customizer.js']
|
||||
},
|
||||
docsGrunt: {
|
||||
src: ['docs/grunt/*.js']
|
||||
}
|
||||
},
|
||||
|
||||
@@ -236,6 +244,23 @@ module.exports = function (grunt) {
|
||||
docs: {}
|
||||
},
|
||||
|
||||
jade: {
|
||||
compile: {
|
||||
options: {
|
||||
pretty: true,
|
||||
data: function () {
|
||||
var filePath = path.join(__dirname, 'less/variables.less');
|
||||
var fileContent = fs.readFileSync(filePath, {encoding: 'utf8'});
|
||||
var parser = new BsLessdocParser(fileContent);
|
||||
return {sections: parser.parseFile()};
|
||||
}
|
||||
},
|
||||
files: {
|
||||
'docs/_includes/customizer-variables.html': 'docs/customizer-variables.jade'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
validation: {
|
||||
options: {
|
||||
charset: 'utf-8',
|
||||
@@ -301,7 +326,7 @@ module.exports = function (grunt) {
|
||||
var testSubtasks = [];
|
||||
// Skip core tests if running a different subset of the test suite
|
||||
if (!process.env.TWBS_TEST || process.env.TWBS_TEST === 'core') {
|
||||
testSubtasks = testSubtasks.concat(['dist-css', 'csslint', 'jshint', 'jscs', 'qunit']);
|
||||
testSubtasks = testSubtasks.concat(['dist-css', 'csslint', 'jshint', 'jscs', 'qunit', 'build-customizer-vars-form']);
|
||||
}
|
||||
// Skip HTML validation if running a different subset of the test suite
|
||||
if (!process.env.TWBS_TEST || process.env.TWBS_TEST === 'validate-html') {
|
||||
@@ -339,5 +364,7 @@ module.exports = function (grunt) {
|
||||
grunt.registerTask('build-glyphicons-data', generateGlyphiconsData);
|
||||
|
||||
// task for building customizer
|
||||
grunt.registerTask('build-customizer', 'Add scripts/less files to customizer.', generateRawFilesJs);
|
||||
grunt.registerTask('build-customizer', ['build-customizer-vars-form', 'build-raw-files']);
|
||||
grunt.registerTask('build-customizer-vars-form', ['jade']);
|
||||
grunt.registerTask('build-raw-files', 'Add scripts/less files to customizer.', generateRawFilesJs);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user