Merge pull request #13023 from frappe/mergify/bp/version-13-pre-release/pr-12999
feat(DX): sourceURL for injected javascript (backport #12999)
This commit is contained in:
commit
20943d463d
1 changed files with 7 additions and 2 deletions
|
|
@ -109,8 +109,9 @@ class FormMeta(Meta):
|
|||
def _add_code(self, path, fieldname):
|
||||
js = get_js(path)
|
||||
if js:
|
||||
self.set(fieldname, (self.get(fieldname) or "")
|
||||
+ "\n\n/* Adding {0} */\n\n".format(path) + js)
|
||||
comment = f"\n\n/* Adding {path} */\n\n"
|
||||
sourceURL = f"\n\n//# sourceURL={scrub(self.name) + fieldname}"
|
||||
self.set(fieldname, (self.get(fieldname) or "") + comment + js + sourceURL)
|
||||
|
||||
def add_html_templates(self, path):
|
||||
if self.custom:
|
||||
|
|
@ -145,6 +146,10 @@ class FormMeta(Meta):
|
|||
if script.view == 'Form':
|
||||
form_script += script.script
|
||||
|
||||
file = scrub(self.name)
|
||||
form_script += f"\n\n//# sourceURL={file}__custom_js"
|
||||
list_script += f"\n\n//# sourceURL={file}__custom_list_js"
|
||||
|
||||
self.set("__custom_js", form_script)
|
||||
self.set("__custom_list_js", list_script)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue