Reputation: 31
I need to use font icons in my application. Can anyone please help me in how to use the font icons in Dojo 2 application.
Thanks in advance
Upvotes: 0
Views: 114
Reputation: 495
Dojo 2 (via @dojo/cli-build-app) will include fonts files that are referenced in CSS. For example defining the font like the following in CSS:
@font-face {
font-family: 'IconFont';
src: url('./fonts/IconFont.eot');
src: local('☺'), url('./fonts/IconFontwoff') format('woff'), url('./fonts/IconFont.svg') format('svg');
font-weight: 400;
}
This will ensure that the build tool includes the actual font files in the built version of the app and then you can use them like normal.
If you're interested with using something like Font Awesome from a CDN, here's an example of using that, where you simply use string values for the classes
properties on the VDOM elements.
https://codesandbox.io/s/3v0qx5lnnm
Upvotes: 0