Where to put javascript files on Phoenix system

So, I have a file foo.jsthat contains the following:

$( document ).ready(function() {
  alert("hello world");
});

and if I put it in the web / static / js folder, then it will not be executed, but if I put it in the web / static / vendor folder, then I wonder why it doesn’t work from the js folder? And where should I put js files? The vendor folder does not seem like the right place ...

+4
source share
2 answers

How phoenixframework uses bruch.io by default. It has a default setting. There are two javascript folders

  • web / static / js
  • web / static / vendor

.js /web/static/vendor, wrapped codebase. brunch.io js ( web/static/js), priv/static/js/app.js

.js web/static/js, codebase, brunch.io, . , require(), , .

, . https://github.com/brunch/brunch-guide/blob/master/content/en/chapter04-starting-from-scratch.md.

brunch-config.js brunch-config.coffee phoenixframework.

+7

, js, html , app.js,

+1

Source: https://habr.com/ru/post/1598487/


All Articles