Include only necessary fonts for target environment specified by Browserslist (#1674)

* Include only necessary fonts for target environment specified by Browserslist

Allow WOFF and WOFF2 to be controlled using environment variables

* Fix links

* Fix merge error

* Update dependencies

* Replace uglifyjs-webpack-plugin with terser-webpack-plugin

* Do not set `targets` if !isESMBuild
This commit is contained in:
ylemkimon
2018-12-03 07:51:13 +09:00
committed by Kevin Barabash
parent 64745b5c8a
commit ce3840d4ce
6 changed files with 96 additions and 94 deletions

View File

@@ -36,6 +36,16 @@ yarn
yarn build
```
It will automatically transpile code and include only necessary fonts for
target environments specified by [Browserslist config](https://github.com/browserslist/browserslist#environment-variables).
For example, if you are making a web app for a kiosk with Chrome 68, run
`BROWSERSLIST="Chrome 68" yarn build` and it will produce build with no
transpilation, as it fully supports ES6, and only include WOFF2 fonts.
You can override included fonts using environment variables. Set `USE_(FONT NAME)`
environment variable to `"true"` or `"false"`, to force a font type to be included
or excluded, respectively.`
If you'd like to use the built KaTeX in other projects, install the package by
specifying the path:
```bash