Question

I am trying to install the following slider to my own Module https://owlcarousel2.github.io/OwlCarousel2/demos/demos.html.

But unfortunately, Magento has its own complicated mechanism to manage its static assets like js and css.

My question is, "Is it possible to install 3rd party js extension on Magento 2?" if yes then how to make it work?

Was it helpful?

Solution

I advise downloading the JS file from the Owl carousel website and including it in your theme. Steps for that can be found here as Prathap linked.

But if you really want to include external JS you can do so via layout XML:

<?xml version="1.0" ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <script src="https://www.google.com/recaptcha/api.js" src_type="url"/>
    </head>
</page>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top