Skip to content

Commit

Permalink
Merge pull request #337 from oddbird/hotfix-local-system-fonts
Browse files Browse the repository at this point in the history
Support local system fonts in @font annotation previews.
  • Loading branch information
jgerigmeyer authored Jan 9, 2019
2 parents 3c9f9b8 + d102523 commit 6359797
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 110 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Herman Changelog


## Unreleased

- 🐛 BUGFIX: Allow local system fonts without `formats` --
[#336](https://github.com/oddbird/sassdoc-theme-herman/issues/336)
- 🏠 INTERNAL: Upgrade dependencies


## 3.0.1: 2019-01-07

- 🐛 BUGFIX: Improve error message when reading external files --
Expand Down
6 changes: 6 additions & 0 deletions docs/CHANGELOG.html
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@ <h3 class="nav-title">

<div class="text-block">
<h1 id="herman-changelog">Herman Changelog</h1>
<h2 id="unreleased">Unreleased</h2>
<ul>
<li>🐛 BUGFIX: Allow local system fonts without <code>formats</code>
<a href="https://github.com/oddbird/sassdoc-theme-herman/issues/336">#336</a></li>
<li>🏠 INTERNAL: Upgrade<span class="widont">&nbsp;</span>dependencies</li>
</ul>
<h2 id="3-0-1-2019-01-07">3.0.1: 2019-01-07</h2>
<ul>
<li>🐛 BUGFIX: Improve error message when reading external files –
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ module.exports = {
}
}
}
if (!isLocal || Object.keys(formats).length) {
if (!isLocal || local || Object.keys(formats).length) {
const ctx = {
isLocal,
hasEmbedded,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"sinon-chai": "^3.3.0",
"srcdoc-polyfill": "^1.0.0",
"webpack": "^4.28.3",
"webpack-cli": "^3.2.0"
"webpack-cli": "^3.2.1"
},
"resolutions": {
"browserslist": ">=2.4.0",
Expand Down
2 changes: 1 addition & 1 deletion templates/fonts/font_face.njk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{%- endif %}
src:
{%- if local and local.length -%}
{%- for name in local %} local('{{ name }}'){{ ';' if only_eot and separate_eot else ',' }}{% endfor -%}
{%- for name in local %} local('{{ name }}'){{ ';' if loop.last and ((only_eot and separate_eot) or orderedFormats.length === 0) else ',' }}{% endfor -%}
{%- endif -%}
{%- for ext in orderedFormats -%}
{%- if formats[ext] and not (ext === 'eot' and separate_eot) -%}
Expand Down
36 changes: 36 additions & 0 deletions test/js/testAnnotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,42 @@ describe('font annotation', function() {
.catch(done);
});

it('adds `@font-face` CSS for `local` without `formats`', function(done) {
const env = {
dir: __dirname,
herman: {
fontpath: path.normalize('/path'),
},
sassjson: {
fonts: {
'test-font': {
normal: {
local: ['this', 'that'],
},
},
},
},
};
const font = annotations.font(env);

font
.resolve(this.data)
.then(() => {
const css =
'@font-face {\n' +
" font-family: 'test-font';\n" +
" src: local('this'), local('that');\n" +
' font-weight: normal;\n' +
' font-style: normal;\n' +
'}\n';

assert.equal(this.data[0].font.localFontCSS, css);
assert.deepEqual(env.localFonts, []);
done();
})
.catch(done);
});

it('adds separate `@font-face` for `eot` and `local`', function(done) {
const env = {
dir: __dirname,
Expand Down
144 changes: 37 additions & 107 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1433,15 +1433,6 @@ babel-messages@^6.23.0:
dependencies:
babel-runtime "^6.22.0"

[email protected]:
version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.23.0.tgz#8364ca62df8eafb830499f699177466c3b03499d"
integrity sha1-g2TKYt+Or7gwSZ9pkXdGbDsDSZ0=
dependencies:
babel-runtime "^6.22.0"
core-js "^2.4.0"
regenerator-runtime "^0.10.0"

babel-runtime@^6.22.0, babel-runtime@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
Expand Down Expand Up @@ -2159,7 +2150,7 @@ chai@^4.2.0:
pathval "^1.1.0"
type-detect "^4.0.5"

chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3:
chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=
Expand All @@ -2179,11 +2170,6 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"

chardet@^0.4.0:
version "0.4.2"
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"
integrity sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=

chardet@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e"
Expand Down Expand Up @@ -2598,9 +2584,9 @@ configstore@^3.0.0:
xdg-basedir "^3.0.0"

connect-history-api-fallback@^1:
version "1.5.0"
resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz#b06873934bc5e344fef611a196a6faae0aee015a"
integrity sha1-sGhzk0vF40T+9hGhlqb6rgruAVo=
version "1.6.0"
resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc"
integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==

[email protected], connect@^3.6.0:
version "3.6.6"
Expand Down Expand Up @@ -3527,9 +3513,9 @@ [email protected]:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=

electron-to-chromium@^1.3.96:
version "1.3.98"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.98.tgz#f200bdac84b1110d7d9904f34f4fc6d5573a8a9c"
integrity sha512-WIZdNuvE3dFr6kkPgv4d/cfswNZD6XbeLBM8baOIQTsnbf4xWrVEaLvp7oNnbnMWWXDqq7Tbv+H5JfciLTJm4Q==
version "1.3.100"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.100.tgz#899fb088def210aee6b838a47655bbb299190e13"
integrity sha512-cEUzis2g/RatrVf8x26L8lK5VEls1AGnLHk6msluBUg/NTB4wcXzExTsGscFq+Vs4WBBU2zbLLySvD4C0C3hwg==

elegant-spinner@^1.0.1:
version "1.0.1"
Expand Down Expand Up @@ -3559,13 +3545,6 @@ encodeurl@~1.0.1, encodeurl@~1.0.2:
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=

encoding@^0.1.11:
version "0.1.12"
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
integrity sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=
dependencies:
iconv-lite "~0.4.13"

end-of-stream@^1.0.0, end-of-stream@^1.1.0:
version "1.4.1"
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43"
Expand Down Expand Up @@ -4152,15 +4131,6 @@ extend@^3.0.0, extend@^3.0.2, extend@~3.0.2:
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"
integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==

external-editor@^2.0.1:
version "2.2.0"
resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5"
integrity sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==
dependencies:
chardet "^0.4.0"
iconv-lite "^0.4.17"
tmp "^0.0.33"

external-editor@^3.0.0:
version "3.0.3"
resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27"
Expand Down Expand Up @@ -4227,9 +4197,9 @@ fast-diff@^1.1.2:
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==

fast-glob@^2.0.2:
version "2.2.4"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.4.tgz#e54f4b66d378040e0e4d6a68ec36bbc5b04363c0"
integrity sha512-FjK2nCGI/McyzgNtTESqaWP3trPvHyRyoyY70hxjc3oKPNmDe8taohLZpoVKoUjW85tbU5txaYUZCNtVzygl1g==
version "2.2.6"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.6.tgz#a5d5b697ec8deda468d85a74035290a025a95295"
integrity sha512-0BvMaZc1k9F+MeWWMe8pL6YltFzZYcJsYU7D4JyDA6PAczaXvxqQQ/z+mDF7/4Mw01DeUc+i3CTKajnkANkV4w==
dependencies:
"@mrmlnc/readdir-enhanced" "^2.2.1"
"@nodelib/fs.stat" "^1.1.2"
Expand Down Expand Up @@ -5459,7 +5429,7 @@ [email protected]:
dependencies:
safer-buffer ">= 2.1.2 < 3"

iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13:
iconv-lite@^0.4.24, iconv-lite@^0.4.4:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
Expand Down Expand Up @@ -5660,25 +5630,6 @@ ini@^1.3.4, ini@~1.3.0:
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==

[email protected]:
version "3.0.6"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.0.6.tgz#e04aaa9d05b7a3cb9b0f407d04375f0447190347"
integrity sha1-4EqqnQW3o8ubD0B9BDdfBEcZA0c=
dependencies:
ansi-escapes "^1.1.0"
chalk "^1.0.0"
cli-cursor "^2.1.0"
cli-width "^2.0.0"
external-editor "^2.0.1"
figures "^2.0.0"
lodash "^4.3.0"
mute-stream "0.0.7"
run-async "^2.2.0"
rx "^4.1.0"
string-width "^2.0.0"
strip-ansi "^3.0.0"
through "^2.3.6"

inquirer@^0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e"
Expand Down Expand Up @@ -6398,9 +6349,9 @@ js-base64@^2.1.8:
integrity sha512-wlEBIZ5LP8usDylWbDNhKPEFVFdI5hCHpnVoT/Ysvoi/PRhJENm/Rlh9TvjYB38HFfKZN7OzEbRjmjvLkFw11g==

js-levenshtein@^1.1.3:
version "1.1.4"
resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.4.tgz#3a56e3cbf589ca0081eb22cd9ba0b1290a16d26e"
integrity sha512-PxfGzSs0ztShKrUYPIn5r0MtyAhYcCwmndozzpz8YObbPnD1jFxzlBGbRnX2mIu6Z13xN6+PTu05TQFnZFlzow==
version "1.1.5"
resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.5.tgz#57e4b1b5cc35e6d2721f118bd5245b36ac56b253"
integrity sha512-ap2aTez3WZASzMmJvgvG+nsrCCrtHPQ+4YB+WQjYQpXgLkM+WqwkpzdlVs5l7Xhk128I/CisIk4CdXl7pIchUA==

"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
Expand Down Expand Up @@ -6770,6 +6721,11 @@ liftoff@^2.5.0:
rechoir "^0.6.2"
resolve "^1.1.7"

lightercollective@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/lightercollective/-/lightercollective-0.1.0.tgz#70df102c530dcb8d0ccabfe6175a8d00d5f61300"
integrity sha512-J9tg5uraYoQKaWbmrzDDexbG6hHnMcWS1qLYgJSWE+mpA3U5OCSeMUhb+K55otgZJ34oFdR0ECvdIb3xuO5JOQ==

limiter@^1.0.5:
version "1.1.3"
resolved "https://registry.yarnpkg.com/limiter/-/limiter-1.1.3.tgz#32e2eb55b2324076943e5d04c1185ffb387968ef"
Expand Down Expand Up @@ -7861,14 +7817,6 @@ no-case@^2.2.0:
dependencies:
lower-case "^1.1.1"

[email protected]:
version "1.6.3"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.6.3.tgz#dc234edd6489982d58e8f0db4f695029abcd8c04"
integrity sha1-3CNO3WSJmC1Y6PDbT2lQKavNjAQ=
dependencies:
encoding "^0.1.11"
is-stream "^1.0.1"

node-gyp@^3.8.0:
version "3.8.0"
resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.8.0.tgz#540304261c330e80d0d5edce253a68cb3964218c"
Expand Down Expand Up @@ -8286,31 +8234,11 @@ onetime@^2.0.0:
dependencies:
mimic-fn "^1.0.0"

opencollective@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/opencollective/-/opencollective-1.0.3.tgz#aee6372bc28144583690c3ca8daecfc120dd0ef1"
integrity sha1-ruY3K8KBRFg2kMPKja7PwSDdDvE=
dependencies:
babel-polyfill "6.23.0"
chalk "1.1.3"
inquirer "3.0.6"
minimist "1.2.0"
node-fetch "1.6.3"
opn "4.0.2"

[email protected]:
version "1.1.1"
resolved "https://registry.yarnpkg.com/openurl/-/openurl-1.1.1.tgz#3875b4b0ef7a52c156f0db41d4609dbb0f94b387"
integrity sha1-OHW0sO96UsFW8NtB1GCduw+Us4c=

[email protected]:
version "4.0.2"
resolved "https://registry.yarnpkg.com/opn/-/opn-4.0.2.tgz#7abc22e644dff63b0a96d5ab7f2790c0f01abc95"
integrity sha1-erwi5kTf9jsKltWrfyeQwPAavJU=
dependencies:
object-assign "^4.0.1"
pinkie-promise "^2.0.0"

[email protected]:
version "5.3.0"
resolved "https://registry.yarnpkg.com/opn/-/opn-5.3.0.tgz#64871565c863875f052cfdf53d3e3cb5adb53b1c"
Expand Down Expand Up @@ -9194,13 +9122,13 @@ postcss-value-parser@^3.0.0, postcss-value-parser@^3.3.0, postcss-value-parser@^
integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==

postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.5, postcss@^7.0.6, postcss@^7.0.7:
version "7.0.7"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.7.tgz#2754d073f77acb4ef08f1235c36c5721a7201614"
integrity sha512-HThWSJEPkupqew2fnuQMEI2YcTj/8gMV3n80cMdJsKxfIh5tHf7nM5JigNX6LxVMqo6zkgQNAI88hyFvBk41Pg==
version "7.0.8"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.8.tgz#2a3c5f2bdd00240cd0d0901fd998347c93d36696"
integrity sha512-WudsIzuTKRw9IInRTPBgVXJ7DKR26HT09Rxp0g3w0Fqh3TUtYICcUmvC0xURj04o3vdcDtnjCAUCECg/p341iQ==
dependencies:
chalk "^2.4.1"
chalk "^2.4.2"
source-map "^0.6.1"
supports-color "^5.5.0"
supports-color "^6.0.0"

prelude-ls@~1.1.2:
version "1.1.2"
Expand Down Expand Up @@ -9577,11 +9505,6 @@ regenerate@^1.2.1, regenerate@^1.4.0:
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11"
integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==

regenerator-runtime@^0.10.0:
version "0.10.5"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658"
integrity sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=

regenerator-runtime@^0.11.0:
version "0.11.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
Expand Down Expand Up @@ -9954,7 +9877,7 @@ rx-lite@^3.1.2:
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102"
integrity sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=

[email protected], rx@^4.1.0:
[email protected]:
version "4.1.0"
resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782"
integrity sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=
Expand Down Expand Up @@ -10945,6 +10868,13 @@ supports-color@^5.3.0, supports-color@^5.4.0, supports-color@^5.5.0:
dependencies:
has-flag "^3.0.0"

supports-color@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.0.0.tgz#76cfe742cf1f41bb9b1c29ad03068c05b4c0e40a"
integrity sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==
dependencies:
has-flag "^3.0.0"

sver-compat@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/sver-compat/-/sver-compat-1.5.0.tgz#3cf87dfeb4d07b4a3f14827bc186b3fd0c645cd8"
Expand Down Expand Up @@ -11854,10 +11784,10 @@ watchpack@^1.5.0:
graceful-fs "^4.1.2"
neo-async "^2.5.0"

webpack-cli@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.2.0.tgz#9648cb6d65060f916e63c3d3b55387fb94c019fd"
integrity sha512-wxnUqH0P5ErcwGIKMZbUqix2FjuUmhpS2N9ukZAuGmk9+3vOt7VY2ZM/90W9UZetf6lOJuBNcsbeGU7uCTLdSA==
webpack-cli@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.2.1.tgz#779c696c82482491f0803907508db2e276ed3b61"
integrity sha512-jeJveHwz/vwpJ3B8bxEL5a/rVKIpRNJDsKggfKnxuYeohNDW4Y/wB9N/XHJA093qZyS0r6mYL+/crLsIol4WKA==
dependencies:
chalk "^2.4.1"
cross-spawn "^6.0.5"
Expand All @@ -11867,8 +11797,8 @@ webpack-cli@^3.2.0:
global-modules-path "^2.3.0"
import-local "^2.0.0"
interpret "^1.1.0"
lightercollective "^0.1.0"
loader-utils "^1.1.0"
opencollective "^1.0.3"
supports-color "^5.5.0"
v8-compile-cache "^2.0.2"
yargs "^12.0.4"
Expand Down

0 comments on commit 6359797

Please sign in to comment.