Skip to content

re: Load specific JS files in Elixir and Phoenix VIEW POST

re: Does this mean that for each request, a JS file is generated? Or is it pre-generated with Webpack? I don't seem to get it completely.

You will have an app.min.js file that was generated by Webpack and contains all your JS code.

But the idea of this guide is to have some kind of rule in our JS code that is similar to this:

if (myCurrentPage == "/contact") {
  // execute this piece code...

if (myCurrentPage == "/about-us") {
  // execute this other piece of code...

So we'll not execute code that is not necessary for some pages...

There's also a great library that I use sometimes and do almost the same thing:


Oh okay ! I thought the idea was to create a JS file for each page. Makes sense now !

Thanks Ricardo !

code of conduct - report abuse