2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-20 20:00:36 +03:00

Use different coding style for Gruntfile

Fixes #12657
This commit is contained in:
Zlatan Vasović
2014-02-08 21:59:17 +01:00
committed by Chris Rebert
parent 9afead3fb0
commit ba4206b644
7 changed files with 46 additions and 28 deletions
+13 -14
View File
@@ -1,32 +1,31 @@
/* global btoa: true */
/*!
* Bootstrap Grunt task for generating raw-files.min.js for the Customizer
* http://getbootstrap.com
* Copyright 2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
var btoa = require('btoa')
var fs = require('fs')
'use strict';
var btoa = require('btoa');
var fs = require('fs');
function getFiles(type) {
var files = {}
var files = {};
fs.readdirSync(type)
.filter(function (path) {
return type == 'fonts' ? true : new RegExp('\\.' + type + '$').test(path)
return type === 'fonts' ? true : new RegExp('\\.' + type + '$').test(path);
})
.forEach(function (path) {
var fullPath = type + '/' + path
return files[path] = (type == 'fonts' ? btoa(fs.readFileSync(fullPath)) : fs.readFileSync(fullPath, 'utf8'))
})
return 'var __' + type + ' = ' + JSON.stringify(files) + '\n'
var fullPath = type + '/' + path;
files[path] = (type === 'fonts' ? btoa(fs.readFileSync(fullPath)) : fs.readFileSync(fullPath, 'utf8'));
});
return 'var __' + type + ' = ' + JSON.stringify(files) + '\n';
}
module.exports = function generateRawFilesJs(banner) {
if (!banner) {
banner = ''
banner = '';
}
var files = banner + getFiles('js') + getFiles('less') + getFiles('fonts')
fs.writeFileSync('docs/assets/js/raw-files.min.js', files)
}
var files = banner + getFiles('js') + getFiles('less') + getFiles('fonts');
fs.writeFileSync('docs/assets/js/raw-files.min.js', files);
};