Where to put javascript files in the Phoenix framework -
so have file foo.js
contains following:
$( document ).ready(function() { alert("hello world"); });
and if put web/static/js folder doesn't executed, if put web/static/vendor folder does, wonder why doesn't work js folder? , should put js files? vendor folder doesn't seem right place ...
as phoenixframework using bruch.io default. in default configuration. there 2 javascript folders
- web/static/js
- web/static/vendor
when add .js files under /web/static/vendor these files put in non wrapped codebase. these files undergo concatinations , other processes , brunch.io other js files (which include files under web/static/js) , put in priv/static/js/app.js
when add .js files under web/static/js these files content put in wrapped codebase , these file undergo concatination other brunch.io processes mentioned. reference these file need use require() require first can use it.
i hope understand reasons here. researched https://github.com/brunch/brunch-guide/blob/master/content/en/chapter04-starting-from-scratch.md.
and these configuration can overriden in file brunch-config.js or brunch-config.coffee in phoenixframework geterated folder content.
Comments
Post a Comment