0

I am trying to add slick.js to my website. I started by following this tutorial- http://inchoo.net/magento-2/magento-2-slick-carousel/

I have my slick.min.js here->app/design/frontend/vendor/theme/web/js/slick.min.js.

I created a requirejs-config.js at app/design/frontend/vendor/theme/web/ (after looking at the comments on the tutorial it mentions to move the file to app/design/frontend/vendor/theme/, so I did all of these steps at both locations.)

I pasted this code in the new requirejs-config.js file-

var config = {
 paths: {
 slick: 'js/slick'
},
shim: {
 slick: {
 deps: ['jquery']
 }
 }
};

I cleaned and flushed the cache, and ran php bin/magento setup:static-content:deploy(I am in developer mode so I do not believe it does anything).

I started researching and came across this answer- Magento2 not reading my requirejs-config.js

I deleted the requirejs-config.js here->pub/static/_requirejs/frontend/Namespace/Theme/en_US/requirejs-config.js

After that, I ran

 php bin/magento cache:clean
 php bin/magento cache:flush
 php bin/magento setup:upgrade
 php bin/magento setup:di:compile

Still can't get that code to show up in require.js. Please advise on what I can try next.

Abhishek Panchal
4,9643 gold badges22 silver badges39 bronze badges
asked Apr 23, 2018 at 19:51

2 Answers 2

1
  1. The requirejs-config.js should be in : app/design/frontend/{Vendor}/{theme}/requirejs-config.js and not in app/design/frontend/{Vendor}/{theme}/web/requirejs-config.js

  2. Your requirejs-config.js should be like this:

    var config = {
     paths: {
     slick: 'js/slick.min'
     },
     shim: {
     slick: {
     deps: ['jquery']
     }
     }
    };
    
  3. Remove the content of :

    var/view_preprocessed, var/cache, var/page_cache

  4. compile the static contents : php bin/magento setup:static-content:deploy -f

answered Apr 23, 2018 at 21:22
1
  • Thank You! I have no idea what did it but that worked. Commented Apr 23, 2018 at 21:40
0

Go to: Vendor\magento\framework\View\Element\Template\File - > Edit Validator.php using a text editor and find this line:

strpos($realPath, $directory) Replace with strpos($path, $directory)
Mohit Patel
4,0484 gold badges27 silver badges57 bronze badges
answered Oct 14 at 9:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.