From be08a62f5246c80ec4b554dac13c8baddb233e53 Mon Sep 17 00:00:00 2001 From: j433866 Date: Tue, 2 Jul 2019 15:31:29 +0100 Subject: [PATCH] Add webpack config for font files --- src/web/static/fonts/bmfonts/Roboto72White.fnt | 2 +- src/web/static/fonts/bmfonts/RobotoBlack72White.fnt | 2 +- src/web/static/fonts/bmfonts/RobotoMono72White.fnt | 2 +- src/web/static/fonts/bmfonts/RobotoSlab72White.fnt | 2 +- webpack.config.js | 12 ++++++++++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/web/static/fonts/bmfonts/Roboto72White.fnt b/src/web/static/fonts/bmfonts/Roboto72White.fnt index fd186892..57238158 100644 --- a/src/web/static/fonts/bmfonts/Roboto72White.fnt +++ b/src/web/static/fonts/bmfonts/Roboto72White.fnt @@ -1,6 +1,6 @@ info face="Roboto" size=72 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=1,1,1,1 spacing=-2,-2 common lineHeight=85 base=67 scaleW=512 scaleH=512 pages=1 packed=0 -page id=0 file="images/Roboto72White.png" +page id=0 file="Roboto72White.png" chars count=98 char id=0 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=66 xadvance=0 page=0 chnl=0 char id=10 x=0 y=0 width=70 height=99 xoffset=2 yoffset=-11 xadvance=74 page=0 chnl=0 diff --git a/src/web/static/fonts/bmfonts/RobotoBlack72White.fnt b/src/web/static/fonts/bmfonts/RobotoBlack72White.fnt index 3d08fe95..d82c9c7b 100644 --- a/src/web/static/fonts/bmfonts/RobotoBlack72White.fnt +++ b/src/web/static/fonts/bmfonts/RobotoBlack72White.fnt @@ -1,6 +1,6 @@ info face="Roboto Black" size=72 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=1,1,1,1 spacing=-2,-2 common lineHeight=85 base=67 scaleW=512 scaleH=512 pages=1 packed=0 -page id=0 file="images/RobotoBlack72White.png" +page id=0 file="RobotoBlack72White.png" chars count=98 char id=0 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=66 xadvance=0 page=0 chnl=0 char id=10 x=0 y=0 width=70 height=99 xoffset=2 yoffset=-11 xadvance=74 page=0 chnl=0 diff --git a/src/web/static/fonts/bmfonts/RobotoMono72White.fnt b/src/web/static/fonts/bmfonts/RobotoMono72White.fnt index f280314d..b9be89b4 100644 --- a/src/web/static/fonts/bmfonts/RobotoMono72White.fnt +++ b/src/web/static/fonts/bmfonts/RobotoMono72White.fnt @@ -1,6 +1,6 @@ info face="Roboto Mono" size=72 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=1,1,1,1 spacing=-2,-2 common lineHeight=96 base=76 scaleW=512 scaleH=512 pages=1 packed=0 -page id=0 file="images/RobotoMono72White.png" +page id=0 file="RobotoMono72White.png" chars count=98 char id=0 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=75 xadvance=0 page=0 chnl=0 char id=10 x=0 y=0 width=45 height=99 xoffset=-1 yoffset=-2 xadvance=43 page=0 chnl=0 diff --git a/src/web/static/fonts/bmfonts/RobotoSlab72White.fnt b/src/web/static/fonts/bmfonts/RobotoSlab72White.fnt index 71e1b131..f1926d5c 100644 --- a/src/web/static/fonts/bmfonts/RobotoSlab72White.fnt +++ b/src/web/static/fonts/bmfonts/RobotoSlab72White.fnt @@ -1,6 +1,6 @@ info face="Roboto Slab Regular" size=72 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=1,1,1,1 spacing=-2,-2 common lineHeight=96 base=76 scaleW=512 scaleH=512 pages=1 packed=0 -page id=0 file="images/RobotoSlab72White.png" +page id=0 file="RobotoSlab72White.png" chars count=98 char id=0 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=75 xadvance=0 page=0 chnl=0 char id=10 x=0 y=0 width=70 height=98 xoffset=0 yoffset=-1 xadvance=70 page=0 chnl=0 diff --git a/webpack.config.js b/webpack.config.js index b811f2d1..c80a2b65 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -104,7 +104,7 @@ module.exports = { ] }, { - test: /\.(ico|eot|ttf|woff|woff2|fnt)$/, + test: /\.(ico|eot|ttf|woff|woff2)$/, loader: "url-loader", options: { limit: 10000, @@ -119,9 +119,17 @@ module.exports = { encoding: "base64" } }, + { // Store font .fnt and .png files in a separate fonts folder + test: /(\.fnt$|bmfonts\/.+\.png$)/, + loader: "file-loader", + options: { + name: "[name].[ext]", + outputPath: "assets/fonts" + } + }, { // First party images are saved as files to be cached test: /\.(png|jpg|gif)$/, - exclude: /node_modules/, + exclude: /(node_modules|bmfonts)/, loader: "file-loader", options: { name: "images/[name].[ext]"