I'm begining a new Elixir Phoenix project and decided to try out version 1.3 after watching Chris McCord's talk on it, and since I'm already using Bootstrap 4 + Font Awesome at work in a Rails project it makes sense to continue using them here.
I searched around a bit for the best way to include Bootstrap 4 and Font Awesome but couldn't find anything that worked 100% correctly for me, esp with regards to Font Awesome. Bootstrap 4 doesn't ship with Glyphs anymore so it was important to get Font Awesome working.
After a bit of fiddling about I managed to get it all working, this is what I did.
Follow the release note instructions for installing Phoenix v1.3.0-rc.0. There is a rc.1 release available, but no notes.
Create a new Phoenix project, noting we now do mix phx.xxx rather than mix phoenix.xxx.
Install the needed npm modules, this is from the new assets subfolder in your Phoenix project.
Update the Brunch config now located in assets/brunch-config.js to use the installed modules.
Add the follow to the files.stylesheets section:
Add two entries to the plugins section for copying the fonts and sass paths:
And finally make it all available in the npm section:
OR here goes the complete file to copy if you're still using the default:
Next, rename assets/css/app.css to assets/css/app.scss and create a place for custom styles.
Update app.scss to import Font Awesome, Bootstrap, and our custom styles.
And lastly don't forget to delete the included Phoenix css which contains Bootstrap 3 and it's custom styles.
The default Phoenix app welcome page looks pretty broken now, but that's good as it means it's using Bootstrap 4. My next step was to swapped it out for one of the examples.