Skip to content

Conversation

@mattolson
Copy link
Contributor

@mattolson mattolson commented May 9, 2018

  • Extract font logic from getFontsCollection helper to make it reusable
  • Add resourceHints helper that generates a set of tags for
    preconnect and dns-prefetch resource hints. This uses the font parsing
    logic from getFontsCollection helper to determine which font providers
    are used for the theme, and adds resource hints for expected hosts
    for these font providers. Also add one for the cdn host.
  • Add getFontLoaderConfig helper that generates a config suitable for
    use in Web Font Loader.
  • This will become 2.0.8 and will need to be ported over to 3.0

_.each(fonts, function fontsIterator(font) {
var split = font.split('_'),
familyKey = split[1], // Eg: Open+Sans
weights = split[2]; // Eg: 400,700italic
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there another way than index? Regex would be safer + maybe a catch or something incase font doesnt have underscores

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is existing code that I didn't spend time refactoring.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk

Copy link

@tpietsch tpietsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would imagine there may be some public JS lib around font parsing or something.

* Extract font logic from getFontsCollection helper to make it reusable
* Add resourceHints helper that generates a set of <link> tags for
  preconnect and dns-prefetch resource hints. This uses the font parsing
  logic from getFontsCollection helper to determine which font providers
  are used for the theme, and adds resource hints for expected hosts
  for these font providers. Also add one for the cdn host.
* Add getFontLoaderConfig helper that generates a config suitable for
  use in Web Font Loader.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants