Can you document how to use font files (and FontAwesome) ?
See original GitHub issueI was reading this: https://nativescript-vue.org/blog/using-fonticons/
It says
Import your fonticon’s font files (normally a .ttf, TrueType Font) into src/assets/fonts
The problem is that the template nativescript-vue/vue-cli-template has not the
srcfolder at all. It has
app`.
It has app/assets
, but fonts are under app/fonts
.
I tried to simply ignore the different folder structure, but this way the font icon are simply not shown… 😦
So, in general, aside to kindly ask you to update this page, I’d like a page where is documented how to add new font file to the basic standard template AND be able to use it on ios (because on Android I have no problem at all)
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
Get Started on the Desktop | Font Awesome Docs
Font Awesome icons can be used on the desktop. ... Get up and running using ligatures to insert icons into your documents by...
Read more >Host Font Awesome Yourself
Copy the fontawesome.js loader and whatever icon styles' .js files you'd like to use into your project's static assets directory (or where ever...
Read more >Host Yourself - Web Fonts | Font Awesome Docs
Set-Up with Web Fonts. Inside the Font Awesome Download or package, you'll find the files you need. The /css folder contains the core...
Read more >Get Started on the Desktop | Font Awesome Docs
Install the Ligature-based Font Files. Get up and running using ligatures to insert icons into your documents by first installing all of the...
Read more >Configuration | Font Awesome Docs
i2svg() method. This allows the library to efficiently watch these for changes and to ignore them for other operations. You can use this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@realtebo The way I got this working is:
In my fonts folder I made font-awesome.css file.
Inside font-awesome.css I added:
.fa { font-family : FontAwesome, fontawesome-webfront; }
Now add the icons to this font-awesome.css
.fa-home:before{ content: "\f015"; }
The list can be found here: http://astronautweb.co/snippet/font-awesome/
In my main.js I added:
import { TNSFontIcon, fonticon } from 'nativescript-fonticon'; TNSFontIcon.debug = true; TNSFontIcon.paths = { 'fa': './fonts/font-awesome.css', }; TNSFontIcon.loadCss(); Vue.filter('fonticon', fonticon);
Now I display icon I added earlier like this:
<Label class="fa" :text="'fa-home' | fonticon"/>
Might not be the best way as I am a beginner but it works.
Here’s what I did to get font awesome to work:
ttf
andotf
files from font awesome insrc/fonts
. I think this would work forapp/fonts
as well ifapp
is your entry point.global.scss
insrc/styles/scss
. It doesn’t really matter where this file is at or what it is actually named. It just matters what you put in it and that you can reference it easily from yourmain.ts
ormain.native.ts
if using the vue CLI 3 plugin.global.scss
file:main.ts
/main.native.ts
file, here is the relevant section to importnativescript-vue-fonticon
Bonus code used to get a nice rounded button look: