Skip to content

Commit

Permalink
Fixes twbs#9925: convert font data to base64, fixing 0xefbfbd (Unicod…
Browse files Browse the repository at this point in the history
…e Replacement Character) chars in customizer fonts.

Merges twbs#9982
  • Loading branch information
hero-m authored and cvrebert committed Oct 10, 2013
1 parent 58a47b6 commit aad7083
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module.exports = function(grunt) {
"use strict";

var btoa = require('btoa')
// Project configuration.
grunt.initConfig({

Expand Down Expand Up @@ -209,7 +210,8 @@ module.exports = function(grunt) {
return type == 'fonts' ? true : new RegExp('\\.' + type + '$').test(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'
}
Expand Down
2 changes: 1 addition & 1 deletion docs-assets/js/customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
if (fonts) {
var fontsFolder = zip.folder('fonts')
for (var fileName in fonts) {
fontsFolder.file(fileName, fonts[fileName])
fontsFolder.file(fileName, fonts[fileName], {base64: true})
}
}

Expand Down
4 changes: 2 additions & 2 deletions docs-assets/js/raw-files.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
}
]
, "devDependencies": {
"grunt": "~0.4.1"
"btoa": "~1.1.1"
, "grunt": "~0.4.1"
, "grunt-contrib-clean": "~0.5.0"
, "grunt-contrib-concat": "~0.3.0"
, "grunt-contrib-connect": "~0.5.0"
Expand Down

0 comments on commit aad7083

Please sign in to comment.