Recent Topics

require_js

Started by on Mar 10, 2012 – Contents updated: Mar 10, 2012

Mar 10, 2012 04:19    

Can we only use require_js inside SkinBeginHtmlHead() ?

Because, most of the javascripts make sense to be loaded before closing body.

Mar 16, 2012 13:33

It's works exactly like you said right now.

In v5 you'll be able to add custom HTML before closing body, right from backoffice.

Mar 17, 2012 00:36

sam2kb wrote:

It's works exactly like you said right now.

In v5 you'll be able to add custom HTML before closing body, right from backoffice.

well when i add require_js inside any other function it did not work.. i will double check tomorrow.

Mar 17, 2012 03:55

I think I misunderstood you. If you want to load some scripts before closing body, you can't do that with require_js.

Just output the scripts in SkinEndHtmlBody method. If they require jQuery, include it as usual with require_js('#jquery#'); in SkinBeginHtmlBody

Mar 17, 2012 09:03

sam2kb wrote:

I think I misunderstood you. If you want to load some scripts before closing body, you can't do that with require_js.

Just output the scripts in SkinEndHtmlBody method. If they require jQuery, include it as usual with require_js('#jquery#'); in SkinBeginHtmlBody

yea but with require_js you avoid loading scripts multiple times.

if i just include scripts with <script></script> iniside SkinEndHtmlBody, you have the risk of loading duplicate scripts.Am i not right ?

Mar 17, 2012 12:47

You are right. Then the only option you have is load them in the <head> with require_js

Mar 17, 2012 12:55

sam2kb wrote:

You are right. Then the only option you have is load them in the <head> with require_js

well at least let that be my feature request for v5. Because i think you would agree that loading scripts in <head> is not always the best practice.


Form is loading...

powered by b2evolution – This forum is powered by b2evolution CMS, a complete engine for your website.