nuxt-font-loader-strategy
Version:
Helps to load fonts and activate them by preloading.
20 lines (13 loc) • 487 B
CSS
<% options.fonts.forEach(font => {
%>-face {
<%
Object.keys(font.properties).forEach(key => {
%>
<%= key %>: <%= key === 'font-family' ? '\'' + font.properties[key] + '\'' : font.properties[key] %>;<%
})
%>
src: <%= font.local.map(name => `local('${name}')` ).join(', ') %> <% if (font.local.length > 0 && font.sources.length > 0){ %>, <% } %>
<%= font.sources.map(file => { return ` url('${file.path}') format('${file.format}')` }).join(',\n') %>
}
<%
}) %>