I have added a custom app and include a js file. I have use bench migrate after that and it works fine. but after logout when i login, js files was not including on site and it included after bench migrate again. Now every time i login, i have to run bench migrate. Why?
and yes, it is on production site.
No reply?
Where have you included the js file, have you put it in a build.json file?
You can also load js files asynchronously using
frappe.require('path-to-file.js', function() {
// your code
})
Yes. I added a allyhomes.min.js file in sites/asssets/js
then in hooks.py i have called by this
app_include_js = "assets/js/allyhomes.min.js"
After that i created a built.json in public folder of app and content is
{ "js/allyhomes.min.js": [ "public/js/custom.js" ] }
and custom.js is in public/js…
Again for this i will need to add a js file to add this code which is currently not working.
Strange but this method is working perfectly on local server(Development, bench start)
Even now i tried with app_include_js = [ "/assets/allyhomes/js/custom.js", ]
still same results.
am getting frustrate now. I don’t its mistake on my side or it is a bug in erpnext. Rest nobody here is to resolve the problem neither doc is good
Have you named the file correctly, it’s build.json and not built.json
Yes its build.json, i copy the file from erpnext app and modified the content to this.
{ "js/allyhomes.min.js": [ "public/js/custom.js" ] }