Extend TMS WEB Core with JS Libraries with Andrew: FontAwesome
This time out, we are exploring FontAwesome, another wildly popular JS library. Like Bootstrap last week, FontAwesome requires no JavaScript coding knowledge and very little in the way of HTML or CSS knowledge either. And while it does have a lot to do with fonts, and is indeed truly awesome, the main benefit we’re going to get from FontAwesome in terms of our TMS WEB Core projects is its enormous icon library. Great. More Icons. Last week, we touched briefly on the topic of Bootstrap Icons. 1,600 or so freely usable icons that you can directly use in your projects. There are also Google Material Icons. Several thousand more icons that also come in five different styles. The Google Material Icons library is even included in the JavaScript Library Manager in the Delphi IDE, so getting started is easy enough. If you’ve used one of these sets of icons previously in your projects, you might be reluctant to switch to something else. The look of the Google icons will be familiar to many and might be somewhat of a safe choice. Long-time developers might feel a bit of a chill when reflecting back on icons of ages past. There was a time when you could pretty accurately guess what tools were used to create an app based entirely on how audacious the icons were. Like acid-wash jeans and tie-dye shirts, these are thankfully well behind us and we now have mostly sane choices to pick from. Also long gone are less-than-fun topics like multi-res bitmaps, bmp-vs-ico, transparency issues, and anything to do with scaling. I suspect our children will never care what a pixel is because they won’t actually be able to see any individual pixels anywhere without a microscope. Back to the topic at hand. Like Google Material Icons, FontAwesome has a handful of different styles to choose from. And I personally much prefer FontAwesome styles to the Google equivalents, but there’s more to the story than just the look of the icons. Much more. Making Your Project FontAwesome The FontAwesome library was recently added to the “Manage JavaScript Libraries” list, sometime around TMS WEB Core 1.9.8 or so. It lists both FontAwesome 4 and FontAwesome 5. FontAwesome 6 also came out a couple of months ago. We’ll run into some of the differences closer to the end of this article. But I think everything we’re going to cover today will work the same in any version unless otherwise noted. One thing that is different between versions is the icons themselves – new icons are added and occasionally icons are changed or removed or, more likely, renamed or redesigned. This can even happen mid-version, so something to keep an eye out for, particularly if you want to use the very latest icons. If your project doesn’t already use FontAwesome, just pick the highest version available from the “Manage JavaScript Libraries” list and you’re done! If you’d like to use a particular version of the FontAwesome library, or a particular CDN, or even host the libraries yourself, then the usual approach of adding files to your Project.html file works just fine as well. Or you can use the JavaScript Library Manager to update the list to suit your particular needs. Both FontAwesome themselves as well as any reputable CDN will […]
