zdenekzahor/webfontloader

There is no license information available for the latest version (3.1.0) of this package.

3.1.0 2021-11-11 08:45 UTC

This package is not auto-updated.

Last update: 2024-05-09 20:33:16 UTC


README

composer require zdenekzahor/webfontloader
extensions:
    webFontLoader: ZdenekZahor\WebFontLoader\DI\WebFontLoaderExtension

webFontLoader:
    cookieName: wfont
    families:
        -
            name: Play
            weights:
                - 400
                - 700
            subsets:
                - latin
                - latin-ext
use ZdenekZahor\WebFontLoader\IWebFontLoaderFactory;
use ZdenekZahor\WebFontLoader\WebFontLoader;

/**
 * @var IWebFontLoaderFactory
 * @inject
 */
public $webFontLoaderFactory;

protected function createComponentWebFontLoader(): WebFontLoader
{
    return $this->webFontLoaderFactory->create();
}
<!DOCTYPE html>
<html class="{control webFontLoader:htmlClass}">
<head>
    {control webFontLoader:head}
</head>
html {
    font-family: sans-serif;
}

html.wf-active {
    font-family: 'Play', sans-serif;
}