I'm trying to integrate font-awesome 5.3 in grails 2.4.4 version, and I'm not supposed to use cdn link. Since grails 2.4.4 doesn't have dependency plugin support for font-awesome 5.3, I can not use the dependency plugins as well.
I just downloaded the bundle and tried to copy all files into my project folder and imported the all.css file into my main.gsp file, but that didn't work. Is there any other approach to fix this? [OR] Did I do anything wrong while placing the bundle files into my project? Can someone suggest me the best approach
Grails 2.4.4 already includes asset-pipeline plugin. So the process that I have adopted is the following:
Create a directory that I usually call vendor in /grails-app/assets
directory, here all css client dependencies should be located, as in your case font-awesome
.
In /grails-app/assets/stylesheets/application.css
file include font-awesome
as a dependency.
Once this is done you will have access to the icons from the views that depend on application.css
file.
I attach an example
Directory tree
/grails-app/assets/stylesheets/application.css
/*
*= require main
*= require mobile
*= require fontawesome-free-5.3.1-web/css/all.css
*= require_self
*/
In order to test, in this example I add an icon in the h1
tag in view /grails-app/views/index.gsp
that extends from /grails-app/views/layouts/main.gsp and that in turn extends from application.css
So in /grails-app/views/index.gsp
I add the icon
<h1>Application Status <i class="fab fa-font-awesome"></i></h1>
Result