aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2014-01-07 22:15:48 -0800
committerChris Rebert <[email protected]>2014-01-07 22:16:52 -0800
commitd1c29af5916b6cb629f0b4f442d796866f7a8b6c (patch)
tree5f68fe1d6b714fcaaa9151285a36eb3e74c4e79b /docs
parentb67fc6906a06169458bc9c72e7f717af68eeedb8 (diff)
downloadbootstrap-d1c29af5916b6cb629f0b4f442d796866f7a8b6c.tar.xz
bootstrap-d1c29af5916b6cb629f0b4f442d796866f7a8b6c.zip
extract raw-files.js generator out of Gruntfile into separate module
Diffstat (limited to 'docs')
-rw-r--r--docs/grunt/bs-raw-files-generator.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/grunt/bs-raw-files-generator.js b/docs/grunt/bs-raw-files-generator.js
new file mode 100644
index 000000000..b38563a06
--- /dev/null
+++ b/docs/grunt/bs-raw-files-generator.js
@@ -0,0 +1,22 @@
+/* jshint node: true */
+
+var btoa = require('btoa')
+var fs = require('fs')
+
+function getFiles(type) {
+ var files = {}
+ fs.readdirSync(type)
+ .filter(function (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'
+}
+
+module.exports = function generateRawFilesJs() {
+ var files = getFiles('js') + getFiles('less') + getFiles('fonts')
+ fs.writeFileSync('docs/assets/js/raw-files.js', files)
+}