Just finished the phoenix tutorial and now trying some things out. First: add a selectionlist to the header of the ‘welcome’ screen. I downloaded the twitter dropdown.js + jquery and put them in priv/static/js, edited brunch-config.js to load jquery first and put something like
in web/templates/layout/app.html.eex . It did not work as expected after I started phoenix.server, so I wanted to remove the js files from priv/static/js. To my surprise they had been removed already, two other js files were generated in their place. Ok, then remove those. I removed the changes from brunch-config.js and web/templates/layout/app.html.eex. Restarted phoenix.server. Chrome caching is disabled. But still I get an error about dropdown.js missing jquery when navigating to the welcome screen, in chrome. In the chrome console I can still see dropdown.js + jquery. Are there more places where I have to remove / change things?
As @chrismccord pointed out to me a few days ago: The proper place to add JS files to is web/static/js for things you want Brunch to compile and add to your app.js, and web/static/assets/js for things you want to copy over 1:1 without changes. This second place is where you can add libraries like dropdown.js. Both of these folders will end up in the root folder priv/js.
To add static files to your application, add a line like <script src="<%= static_path(@conn, "/js/filename.js") %>"></script> to your template file(s).