Don't try to convert huge fonts to woff2, otherwise the server freezes for too long
This commit is contained in:
@@ -55,6 +55,12 @@ var FontAnalyzer = function() {
|
||||
debug('File is already a woff2.');
|
||||
deferred.resolve(entry);
|
||||
|
||||
} else if (fileSize > 1024 * 1024) {
|
||||
|
||||
// Don't try to convert huge font files, it would block the server for several minutes
|
||||
debug('Font is too big, skipping conversion.');
|
||||
deferred.resolve(entry);
|
||||
|
||||
} else if (entry.isWoff) {
|
||||
|
||||
debug('File is a woff. Let\'s convert to woff2');
|
||||
@@ -67,7 +73,7 @@ var FontAnalyzer = function() {
|
||||
woff2 = ttf2woff2(ttf);
|
||||
newFileSize = woff2.length;
|
||||
|
||||
debug('New image size is %d', newFileSize);
|
||||
debug('New font size is %d', newFileSize);
|
||||
debug('Filesize is %d bytes smaller (-%d%)', fileSize - newFileSize, Math.round((fileSize - newFileSize) * 100 / fileSize));
|
||||
entry.weightCheck.sizeAsWoff2 = newFileSize;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user