PeterDavidCarter
The helpers in my template result in this code when I view the source of my site while it’s serving at localhost:
<script src="/js/app.js"></script>
<script src="/js/nav.js"></script>
The local file structure is …
/assets
/js/
app.js
nav.js
But while the app.js file serves fine, the nav.js shows a 404 in the developer console. Why is the Phoenix server refusing to serve this file and how do I fix it?
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
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
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
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
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
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
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
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
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
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
OvermindDL1
Uh, but Phoenix doesn’t host out of assets by default, it hosts out of
./priv/staticby default, do you have a nav.js in there?Whatever build system you use at the very least either needs to concat nav into app (the default one that phoenix uses, brunch, does that automatically) or you need to have it copy nav to the output priv/static directory.
PeterDavidCarter
My brunch file has
The
privsubdirectories don’t actually have the app.js file, which is what’s confusing me even more.I’m currently just using the default Phoenix development settings. I don’t dare push to production without being sure.
OvermindDL1
This means that everything in the
js/navigationdirectory in assets will be compiled to nav.js, but your listing had no such directory, so that does nothing. Currently app.js is taking in everything under js, so nav is being put into it too.Should be in something like
priv/static/js/app.jsor so, and only once you either start the dev server or so.PeterDavidCarter
My apologies for not including full details of my solution:
Exists in my /js directory.
I can remove the js subdirectories, but at the moment I’m just testing that brunch works and I wanted to see master.js compiled to nav.js but I’m not seeing that.
OvermindDL1
I doubt it still would, the
app.jsis grabbing everything under js, including the things in the navigation folder, so when the nav.js entry is hit there is nothing left for it to take. Fixup the app regex to exclude the navigation directory to start.PeterDavidCarter
Wow. I wouldn’t have thought of it as ‘grabbing everything’ in the sense of removing stuff (would have thought it works more cp than mv). I thought it was just spidering the directories. I have a few things I need to do right now but if your solution works I’ll be very impressed!
OvermindDL1
Brunch is powerful, but it does have a few specific things to be aware of, all in its documentation though.
PeterDavidCarter
Yeah. When you’re unemployed and trying to put a showcase site together you tend to go with getting functionality up first. I did read some of the documentation but urg, sometimes it’s difficult to juggle stuff :/. Will have more of a look tomorrow.
PeterDavidCarter
Ok, I now have this:
in my brunch file, and have even removed all of the import statements in my app.js file, but it’s still compiling all the JavaScript into a single app.js file

peerreynders
I think one of the issues you are battling is that the second pattern covers files that are already included in the first pattern. The easiest way to deal with that is to move everything that is under
/jsbut not in/js/navigationinto a separate folder like/js/app. Then rewrite the configuration as:According to documentation that should give you two separate files.