hq1
Hi,
I am completely clueless when it comes to the whole static assets building pipeline. That’s probably the most overwhelming programming experience in my career thus far ![]()
Seriously though, can anyone please share a snippet of things I need to add to have FontAwesome icons available in a phoenix app?
I’m using Phoenix 1.4.0 so I guess that’s webpack then, plus I do npm install in assets directory to get the priv contents built. Everything is pretty much at mix phx.new defaults. Pls send halp.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hauleth
You enter
assetsdirectory and then follow NPM instructions. That is it. Phoenix assets pipeline is exactly the same way as any other webpack project with specific build directory (../priv/static) and that is all.adrianrl
Hi, when it comes to icons, fonts or heavy dependencies it’s a good idea to serve those assets using their respective CDNs, so I’d rather add a simple
linktag to include Font Awesome. You should only serve by yourself those dependencies that you want to customize.hq1
I wish. Nothing related to font awesome ends up in
priv/staticafter doing just that.“Same way as any other webpack project” means nothing to me unfortunately.
hq1
That makes sense, I’ll see if I can just put those pre-built assets on S3 due to privacy concerns.
hauleth
Have you restarted your application? It need to be rebuilt after the fact.
MrDoops
You might need something like File Loader to manage the kinds of assets FontAwesome provides. This guide seems to go over using Font Awesome and File Loader.
kokolegorille
I have this loader for fonts in my webpack.config.js, in the modules/rules section
Then in app.js, I load app.scss, and in app.scss, I load fontawesome, something like this…
But for this to work, I added following dev dependencies,
You might show your webpack.config.js, and your package.json.
eahanson
Another option is to download individual font awesome icons as SVGs into
assets/static/imagesand them emit them in your templates or views with Phoenix Inline SVG.If you only want a few icons, this can reduce the size of your responses and doesn’t involve any webpack stuff. Caveats: some older browsers have issues with SVG, and every time you want a new icon, you have to download it and add it to your assets directory.
hq1
Thank you, that worked!
belgoros
Navigate to your phoenix app assets directory:
Install free edition of fontawesome as explained here:
You will see
package.jsonupdated with a new entry:You will have to install
file-loaderpackage as well:npm install file-loader.Then modify
webpack.config.jsto be able to copy awesome fonts and extract SCSS files:Next, modify your
app.scssfile as follows (I also use Bootrstrap, so remove the related import if you don’t use it):And finally, my
_custom.scssfile (remove$primarycontaining line, it is for Bootrstap override):Hope, this helps.