Search code examples
laravelnpmsassfont-awesomevite

Installing font-awesome with Laravel 9 (Vite)


i'm using Laravel 9 which doesn't use mix anymore, but vite, to bundle resources, i'm also not using any preprocessors like sass or less and don't really know anything about them.

Every text about adding font awesome on the internet is for Laravel 8 and bellow which didn't use vite. Also they all require me to put the font awesome packs in app.sass file which i don't have and am not sure how exactly to install and use.

I'm a student and am developing the application for an offline presentation, so no CDN's allowed.

Could somebody explain the process of installing font awesome without sass and with vite, or if sass is a must, explain to me in short, what it is, how do i install it, and use it.

Thanks in advance.


Solution

  • add fontawesome library

    npm install @fortawesome/fontawesome-free
    

    in the file /resources/css/app.css:

    @import "@fortawesome/fontawesome-free/css/all.css";
    
    @tailwind base;
    @tailwind components;
    @tailwind utilities;
    

    then run

    npm run build or npm run dev