How attached the erpnext assets js/css into custom page under www folder of custom app

Currently, I did like this in order to include a .js file, but every time I built I got a new hash generated, so I need to update after that. any ways I can do this better? thanks

my pages are store in www/page.(html.js.css)

// included frappe and erpnext js, abit hack code here
console.log('js called view pos');
$("#target").click(function () {
    console.log("Handler for .click() called by jquery");

Those bundles are all loaded globally and shouldn’t need to be required at runtime. Are you facing a problem calling api functions without the require statement?

As you see, I am using a portal page, www/page.
but i need the modal or dialog use inside my page

in frappe/public/js/frappe/views/calendar/calendar.js there is an extends of frappe.views.ListView with

get required_libs() {
		let assets = [
		let user_language = frappe.boot.user.language;
		if (user_language && user_language !== 'en') {
		return assets;

May be you can extends your JS page controler with something like this ?

On the other and I check

and there is only

frappe.require('/assets/js/e-commerce.min.js', function() {
				new erpnext.ProductView({
					view_type: view_type,
					products_section: $('#product-listing'),
					item_group: me.item_group

Does it mean that this link to hash file is manage by frappe ?

Ah, gotcha. I didn’t realize those apis weren’t loaded on portal pages.

1 Like