Javascript on a single (or several) pages only

I’m not sure how to accomplish that.

Where I’ve been using it is to change behavior of the UI in different parts of the app. It hasn’t been after saving bandwidth, as I’ve been doing pretty much everything in vanilla JS or very specific frameworks (like fabric.js).

For example, there are several ways to display a map or other feature and load the other UI features.
You can have an if statement that only uses the relevant parts of the code in app.js. Or you can have that code only execute in separate modules, like the technique in the link.

That was enough to solve my dilemma of a very messy app.js. I couldn’t find an obvious way of doing what you wanted when I originally sought it out a few months ago, or at least anything with a simple search term I could think of. Maybe by doing something with Brunch and Phoenix itself? But, I really don’t know. I saw the second part of that article was about webpack, and that may be required to do something like that. It didn’t seem worth it for what I was doing.

*Edited because the second part is webpack, not jetpack