randm's avatar
Level 6

Can I bundle font-awesome css code with my css code using laravel-mix

font-awesome is used by every page of my application. How can I bundle my app.css along with font-awesome/css/all.min.css?

Will I have to download font-awesome package locally first? Is so, is there a way to bundle the code without having to manually download it?

This is how I currently bundle my css files

mix.postCss('resources/css/*.css', 'public/css/bundle.css',
    [
        require('precss')()
    ]);
0 likes
4 replies
jeroenvanrensen's avatar

Hi @malhayek,

I don't know how to do it, but why don't you just use the Font Awesome CDN or import it using a stylesheet?

Jeroen

randm's avatar
Level 6

I don't want to use cdn in my app. I want to bundle it along with other css files I have.

squibby's avatar

Install via your package.json and require("@fortawesome/fontawesome-free/css/all.min.css"); in your app.js file.

randm's avatar
Level 6

This answer seems to have done 90% of the work https://stackoverflow.com/questions/43451509/how-to-install-font-awesome-in-laravel-mix#answer-49716723

However, that creates a folder called /fonts/vendor/@fortawesome/fontawesome-fee How can I control this?

Is there a way to control where the fonts get published? I know I can manually copy the fonts like this

mix.copy('node_modules/@fortawesome/fontawesome-free/webfonts','public/webfonts')

But, that does not stop the /fonts/vendor/@fortawesome/fontawesome-fee from being generated.

How can I control the destination of the font-files?

Please or to participate in this conversation.