Prestashop 8.1 Add remote js file in theme.yml

51 Views Asked by At

I need to add a remote js file to my shop.

I have edited the classic theme.yml and added:

assets:
  js:
    all:
      - id: xxxx-widget
        position: bottom
        inline: true
        path: cdn.access-me.software/accssme/accssmetool.js
        priority: 20
        server: remote
        version: 33

But doesn't works, the js script tag doesn't appear in the DOM.

I also tried adding the protocol.

Of course chache is disabled. The YML format is respected. No errors on console or in servers logs.

What is wrong? Is there anything I must do?

1

There are 1 best solutions below

0
Paul - ébewè On

First (as shown here: https://devdocs.prestashop-project.org/8/themes/getting-started/asset-management/#registering-in-themes) you need to change a little bit your code and replace

path: cdn.access-me.software/accssme/accssmetool.js

with

path: //cdn.access-me.software/accssme/accssmetool.js

Then, for PrestaShop to take your modification into account, you need to manually delete the file:

  • config/themes/your_theme/shop{id_shop}.json