Zend certified PHP/Magento developer

Magento 2 how to add external css and js library with RequireJS?

I’m struggling trying to add this js library AOS

This is what I’ve tried to add both, css and js:

in Theme/Magento_Theme/layout/cms_index_index.xml i have this code:

< ?xml version="1.0"?>


    
        
         
    

The reason of why i’m using cms_index_index.xml instead of default_head_blocks.xml is because I want the library just be available in the home page.

Now for javascript I have this:
Theme/Magento_Theme/requirejs-config.js

var config = {
    paths: {
            'bootstrap':'Magento_Theme/js/bootstrap.bundle',
            'aos':"https://unpkg.com/aos@2.3.1/dist/aos"
    } ,
    shim: {
        'bootstrap': {
            'deps': ['jquery']
        },
        'aos': {
            'deps': ['jquery']
        },
    }
};

Bootstrap is working fine by the way.

Finally in Theme/Magento_Theme/templates/html/header.phtml i have this code:


I practically did the same as I did for bootstrap, because bootstrap is working fine, but I don’t know why AOS is not working. It should work just by adding classes like bootstrap.

Thanks and greetings!