Magento 2 – Custom _typography.less Gives Error

magento2

I'm attempting to build a theme using Magentos UI library. Per the instructions on http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/using-fonts.html I have created a _typography.less file for my custom fonts. This fails with the following error.

Compilation from source:

frontend/mytheme/theme/en_US/css/styles-m.less

.font-face is undefined
in
/var/www/html/magento2/var/view_preprocessed/css/frontend/mytheme/theme/en_US/css/source/_typography.less

the _typography.less file includes

.font-face(
    @family-name: 'latoregular',
    @font-path: '@{baseDir}fonts/lato/lato-regular-webfont',
    @font-weight: normal,
    @font-style: normal
);

.font-face(
    @family-name: 'latomedium',
    @font-path: '@{baseDir}fonts/lato/lato-medium-webfont',
    @font-weight: normal,
    @font-style: normal
);

Best Answer

Renaming

.font-face

to

.lib-font-face

sorts this issue. Per github the UI library mixins had been renamed. The magento documentation just hadn't been updated to reflect the change.

Related Topic