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.
2 Answers 2
The
requirejs-config.jsshould be in :app/design/frontend/{Vendor}/{theme}/requirejs-config.jsand not inapp/design/frontend/{Vendor}/{theme}/web/requirejs-config.jsYour
requirejs-config.jsshould be like this:var config = { paths: { slick: 'js/slick.min' }, shim: { slick: { deps: ['jquery'] } } };Remove the content of :
var/view_preprocessed,var/cache,var/page_cachecompile the static contents :
php bin/magento setup:static-content:deploy -f
-
Thank You! I have no idea what did it but that worked.tjjen– tjjen2018年04月23日 21:40:18 +00:00Commented Apr 23, 2018 at 21:40
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)
Explore related questions
See similar questions with these tags.