Laravel asset compilation for Laravel 9 + Laravel Mix 6 + Font Awesome 6


Before triggering Laravel Mix, we want Node.js and NPM installed on your machine. Let’s check by running the following commands.

node -v
npm -v
npm install -D laravel-mix@latest postcss@latest autoprefixer@latest
npm install -D @fortawesome/fontawesome-free
const mix = require('laravel-mix');mix.setPublicPath('public');
mix.js('resources/js/app.js', 'public/js')
.postCss('resources/css/app.css', 'public/css', [
"devDependencies": {
"@fortawesome/fontawesome-free": "^6.0.0",
@import '~@fortawesome/fontawesome-free/css/fontawesome';
@import '~@fortawesome/fontawesome-free/css/regular';
@import '~@fortawesome/fontawesome-free/css/solid';
@import '~@fortawesome/fontawesome-free/css/brands';
npx mix -p
npm run prod
<link type="text/css" rel="stylesheet" href="{{ mix('css/app.css') }}">



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Karl Hill

Karl Hill

Full Stack Engineer at NASA. Volunteer at Smithsonian’s The Renwick Gallery, and former drummer of #GovernmentIssue.