You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by James Yong <ja...@apache.org> on 2020/05/25 15:34:01 UTC

Allow external script in multi-block html template to be headerized

Hi all,

Currently setting multi-block=true for the html-template, allows inline script within the freemarker
to be transformed to an external script. This helps to reduce the CSP errors.

Propose to allow external scripts within the multi-block html template, to be rendered within the html head tag, when a new attribute data-import is set to “head” e.g.

<script src="/common/js/jquery/plugins/jsTree/jquery.jstree.js" type="application/javascript" data-import="head"></script>

With the new feature we can define external scripts in the multi-block html template that is using the library, instead of setting in layoutSetting.javaScripts.
This new feature helps with dependency management of Javascript and also reduce CSP errors.

Regards,
James

Re: Allow external script in multi-block html template to be headerized

Posted by James Yong <ja...@apache.org>.
Hi all,

Created JIRA issue OFBIZ-11741.
Also uploaded a patch usimg jstree library as example.
The library will only be loaded when required.

Regards,
James

On 2020/05/25 15:34:01, James Yong <ja...@apache.org> wrote: 
> Hi all,
> 
> Currently setting multi-block=true for the html-template, allows inline script within the freemarker
> to be transformed to an external script. This helps to reduce the CSP errors.
> 
> Propose to allow external scripts within the multi-block html template, to be rendered within the html head tag, when a new attribute data-import is set to “head” e.g.
> 
> <script src="/common/js/jquery/plugins/jsTree/jquery.jstree.js" type="application/javascript" data-import="head"></script>
> 
> With the new feature we can define external scripts in the multi-block html template that is using the library, instead of setting in layoutSetting.javaScripts.
> This new feature helps with dependency management of Javascript and also reduce CSP errors.
> 
> Regards,
> James
>