From 101501189cff3c39f9a08b8b65f7c835ea1a84b8 Mon Sep 17 00:00:00 2001 From: ylemkimon Date: Mon, 13 Aug 2018 13:12:33 +0900 Subject: [PATCH] Enable environment variable USE_TTF to disable bundling TTF fonts (#1600) * Use environment variable USE_TTF to disable bundling TTF fonts * Do not bundle TTF fonts on CircleCI build --- .circleci/config.yml | 2 +- webpack.common.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e1847ad8..c947ca0f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -80,7 +80,7 @@ jobs: - run: name: Build KaTeX - command: yarn build + command: USE_TTF=false yarn build - store_artifacts: path: dist/katex.min.js diff --git a/webpack.common.js b/webpack.common.js index c5ba29ff..3815bc68 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -49,6 +49,13 @@ function createConfig(target /*: Target */, dev /*: boolean */, }); } + const lessOptions = {}; + if (process.env.USE_TTF === "false") { + lessOptions.modifyVars = { + 'use-ttf': false, + }; + } + return { mode: dev ? 'development' : 'production', context: __dirname, @@ -85,7 +92,10 @@ function createConfig(target /*: Target */, dev /*: boolean */, use: [ dev ? 'style-loader' : MiniCssExtractPlugin.loader, ...cssLoaders, - 'less-loader', + { + loader: 'less-loader', + options: lessOptions, + }, ], }, {