-->

Prestashop 1.7 JS files not being added

2020-05-01 03:51发布

问题:

Working on Prestashop 1.7 and updated my theme.yml file to look like the below but it doesn't add in the file. The file is in that directory but it isn't being pulled in. Any suggestions to the code? I want to include the JS file but it isn't being pulled in.

assets:
  # If you're using this theme as child and you want to load
  # the parent theme assets, uncomment this line.
  # use_parent_assets: true

  # The following lines are showing how to load assets in your page
  # Uncomment and change value to start loading css or js files
 css:
   all:
     - id: theme-custom
       path: assets/css/custom.css
#    product:
#      - id: product-style
#        path: assets/css/product.css
#        media: all
#        priority: 200
 js:
   all:
      - id: slick
        path: assets/js/external-lib.js
        priority: 30
        position: bottom
   cart:
     - id: theme-custom
       path: assets/js/custom.js

回答1:

You need to mannually delete or rename the file

config/themes/{theme_name}/shop{shopid}.json

It has priority ove that one. It's already reported and solved for 1.7.1. Then the code in your assets will be added to the cached one (to reduce the number of file loading).