Merge pull request #12999 from ankush/add_sourceurl
feat(DX): sourceURL for injected javascript
This commit is contained in:
commit
d9e229bc14
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