aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2014-03-17 03:39:37 -0700
committerChris Rebert <[email protected]>2014-03-17 03:39:37 -0700
commit4a4dff00262aa74510567890eecbf71675805b15 (patch)
treeff143b235ed1454086923012669a4302e9a8f50c
parentdcffbbab61fe717f5d379d417a5789b92a6ec488 (diff)
parent86dfcd1a96396fba1e65d9ffad3c34a5d8dc41a6 (diff)
downloadbootstrap-4a4dff00262aa74510567890eecbf71675805b15.tar.xz
bootstrap-4a4dff00262aa74510567890eecbf71675805b15.zip
Merge branch 'ZDroid-grunt-glyphicons'
-rw-r--r--Gruntfile.js2
-rw-r--r--grunt/bs-glyphicons-data-generator.js11
2 files changed, 10 insertions, 3 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
index 59205a25a..b4438e89d 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -453,7 +453,7 @@ module.exports = function (grunt) {
// This can be overzealous, so its changes should always be manually reviewed!
grunt.registerTask('change-version-number', 'sed');
- grunt.registerTask('build-glyphicons-data', generateGlyphiconsData);
+ grunt.registerTask('build-glyphicons-data', function () { generateGlyphiconsData.call(this, grunt); });
// task for building customizer
grunt.registerTask('build-customizer', ['build-customizer-html', 'build-raw-files']);
diff --git a/grunt/bs-glyphicons-data-generator.js b/grunt/bs-glyphicons-data-generator.js
index b71194367..82dc727b6 100644
--- a/grunt/bs-glyphicons-data-generator.js
+++ b/grunt/bs-glyphicons-data-generator.js
@@ -7,7 +7,7 @@
'use strict';
var fs = require('fs');
-module.exports = function generateGlyphiconsData() {
+module.exports = function generateGlyphiconsData(grunt) {
// Pass encoding, utf8, so `readFileSync` will return a string instead of a
// buffer
var glyphiconsFile = fs.readFileSync('less/glyphicons.less', 'utf8');
@@ -17,6 +17,7 @@ module.exports = function generateGlyphiconsData() {
var iconClassName = /^\.(glyphicon-[^\s]+)/;
var glyphiconsData = '# This file is generated via Grunt task. **Do not edit directly.**\n' +
'# See the \'build-glyphicons-data\' task in Gruntfile.js.\n\n';
+ var glyphiconsYml = 'docs/_data/glyphicons.yml';
for (var i = 0, len = glyphiconsLines.length; i < len; i++) {
var match = glyphiconsLines[i].match(iconClassName);
@@ -30,5 +31,11 @@ module.exports = function generateGlyphiconsData() {
fs.mkdirSync('docs/_data');
}
- fs.writeFileSync('docs/_data/glyphicons.yml', glyphiconsData);
+ try {
+ fs.writeFileSync(glyphiconsYml, glyphiconsData);
+ }
+ catch (err) {
+ grunt.fail.warn(err);
+ }
+ grunt.log.writeln('File ' + glyphiconsYml.cyan + ' created.');
};