abdfahim
Well-known member
Hi,
I want to add external JS and CSS file in my addon.
1. For JS file, I tried using template hook "page_container_js_body" in the following way, but it fails.
However, I can add inline JS with the same command without an issue. Also, I can add the JS file with simple template modification just by adding following line in page_container_js_body template
2. How to add external CSS files in an add on. Should I just create a new template copying that CSS file?
I want to add external JS and CSS file in my addon.
1. For JS file, I tried using template hook "page_container_js_body" in the following way, but it fails.
Code:
if($hookName == 'page_container_js_body')
{
$contents = "<xen:require js=\"js/MyTest/owl.carousel.min.js\" />.$contents;
}
However, I can add inline JS with the same command without an issue. Also, I can add the JS file with simple template modification just by adding following line in page_container_js_body template
Code:
<xen:require js="js/MyTest/owl.carousel.min.js" />
2. How to add external CSS files in an add on. Should I just create a new template copying that CSS file?