Created
January 18, 2020 23:28
-
-
Save RafaelKr/155a570ec4bb1835ed660aba731ddd9b to your computer and use it in GitHub Desktop.
Header Editor config to allow loading Fira Code font on github.com and gitlab.com, see https://medium.com/@sportebois/how-to-make-online-code-easier-to-read-with-custom-font-with-ligatures-d6daa2c89325
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"request": [], | |
"sendHeader": [], | |
"receiveHeader": [ | |
{ | |
"enable": true, | |
"name": "Fira Code", | |
"ruleType": "modifyReceiveHeader", | |
"matchType": "regexp", | |
"pattern": "^http[s]*:\\/\\/(?:[^/\\.]+\\.)*(?:github\\.com|gitlab\\.com)\\/", | |
"exclude": "", | |
"group": "Content-Security-Policy Extensions", | |
"isFunction": true, | |
"code": "// Rule for https://medium.com/@sportebois/how-to-make-online-code-easier-to-read-with-custom-font-with-ligatures-d6daa2c89325\n\nconst cspHeader = Object\n .values(val)\n .find((header) => header.name.toLowerCase() === 'content-security-policy')\n\nif (cspHeader) {\n cspHeader.value = cspHeader.value\n .replace(/(connect-src[^;]*)/, '$1 https://cdn.rawgit.com/tonsky/FiraCode/')\n .replace(/(style-src[^;]*)/, '$1 https://cdn.rawgit.com/tonsky/FiraCode/')\n .replace(/(font-src[^;]*)/, '$1 https://cdn.rawgit.com/tonsky/FiraCode/')\n}\n\n" | |
} | |
], | |
"receiveBody": [] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment