1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-07-31 19:00:23 +02:00

Fixes #9925: convert font data to base64, fixing 0xefbfbd (Unicode Replacement Character) chars in customizer fonts.

Merges #9982
This commit is contained in:
herom
2013-08-21 14:16:45 +04:30
committed by Chris Rebert
parent 58a47b6bfd
commit aad70834fc
4 changed files with 8 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
module.exports = function(grunt) { module.exports = function(grunt) {
"use strict"; "use strict";
var btoa = require('btoa')
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({
@@ -209,7 +210,8 @@ module.exports = function(grunt) {
return type == 'fonts' ? true : new RegExp('\\.' + type + '$').test(path) return type == 'fonts' ? true : new RegExp('\\.' + type + '$').test(path)
}) })
.forEach(function (path) { .forEach(function (path) {
return files[path] = fs.readFileSync(type + '/' + path, 'utf8') return type == 'fonts' ? files[path] = btoa(fs.readFileSync(type + '/' + path)) :
files[path] = fs.readFileSync(type + '/' + path, 'utf8')
}) })
return 'var __' + type + ' = ' + JSON.stringify(files) + '\n' return 'var __' + type + ' = ' + JSON.stringify(files) + '\n'
} }

View File

@@ -129,7 +129,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
if (fonts) { if (fonts) {
var fontsFolder = zip.folder('fonts') var fontsFolder = zip.folder('fonts')
for (var fileName in fonts) { for (var fileName in fonts) {
fontsFolder.file(fileName, fonts[fileName]) fontsFolder.file(fileName, fonts[fileName], {base64: true})
} }
} }

File diff suppressed because one or more lines are too long

View File

@@ -20,7 +20,8 @@
} }
] ]
, "devDependencies": { , "devDependencies": {
"grunt": "~0.4.1" "btoa": "~1.1.1"
, "grunt": "~0.4.1"
, "grunt-contrib-clean": "~0.5.0" , "grunt-contrib-clean": "~0.5.0"
, "grunt-contrib-concat": "~0.3.0" , "grunt-contrib-concat": "~0.3.0"
, "grunt-contrib-connect": "~0.5.0" , "grunt-contrib-connect": "~0.5.0"