Built for Magento 2
app/code/Mage2sk/SlickSlider/view/frontend/requirejs-config.js
app/code/Mage2sk/SlickSlider/view/frontend/requirejs-config.js
Key Features:
Additional Services
Built-in from day one. No add-ons, no upsell, no licence keys to renew.
app/code/Mage2sk/SlickSlider/view/frontend/requirejs-config.js
Adobe Magento Extension Quality Program — passes with zero severity-10 violations.
Vanilla JS, no jQuery dependency. Drop-in compatible with both default Luma and Hyva themes.
Lifetime updates with every Magento release. No subscription, no licence keys, no upsells.
Slick Slider Integration for Magento 2. A premium Magento 2 extension built by Top Rated Plus developer Kishan Savaliya.
We will learn here, how to use Slick Slider in Magento 2 step by step.
We can create new module in app/code/ directory..
Mage2sk_SlickSlider here, So Mage2sk is vendor name and SlickSlider is name of this module.Mage2sk) and move into that directory.SlickSlider)Now Go to : app/code/Mage2sk/SlickSlider
app/code/Mage2sk/SlickSlider/etc/module.xml and it's content for our module is :<?xml version="1.0"?>
<!--
/**
* Mage2sk Use Slick slider in Magento 2
*
* @package Mage2sk_SlickSlider
* @author Kishan Savaliya <kishansavaliyakb@gmail.com>
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Mage2sk_SlickSlider" setup_version="1.0.0" />
</config>
In this file, we register a module with name Mage2sk_SlickSlider and the version is 1.0.0.
ComponentRegistrar class. This file will be placed in module's root directory.In this step, we need to create this file:
app/code/Mage2sk/SlickSlider/registration.php
And it’s content for our module is:
<?php
/**
* Mage2sk Use Slick slider in Magento 2
*
* @package Mage2sk_SlickSlider
* @author Kishan Savaliya <kishansavaliyakb@gmail.com>
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Mage2sk_SlickSlider',
__DIR__
);
Mage2sk_SlickSlider module.php bin/magento module:status
If you follow above step, you will see this in the result:
List of disabled modules:
Mage2sk_SlickSlider
This means the module has recognized by the system but it is still disabled. Run this command to enable it:
php bin/magento module:enable Mage2sk_SlickSlider
The module has enabled successfully if you saw this result:
The following modules has been enabled:
- Mage2sk_SlickSlider
This’s the first time you enable this module so Magento require to check and upgrade module database. We need to run this command:
php bin/magento setup:upgrade
requirejs-config.js fileCreate requirejs-config.js this file here in module..
app/code/Mage2sk/SlickSlider/view/frontend/requirejs-config.js
Content for this file is ..
var config = {
paths: {
slick: 'Mage2sk_SlickSlider/js/slick'
},
shim: {
slick: {
deps: ['jquery']
}
}
};
slick.js and slick.min.js filesYou can download latest version of slick here
Download that and extract .zip file and copy slick.js and slick.min.js files from there and paste that here..
app/code/Mage2sk/SlickSlider/view/frontend/web/js/slick.js
and
app/code/Mage2sk/SlickSlider/view/frontend/web/js/slick.min.js
slick.less and slick-theme.less filesCopy .less files from downloaded directory to below mentioned path..
app/code/Mage2sk/SlickSlider/view/frontend/web/css/source/slick.less
and
app/code/Mage2sk/SlickSlider/view/frontend/web/css/source/slick-theme.less
_module.less fileNow create _module.less file here..
app/code/Mage2sk/SlickSlider/view/frontend/web/css/source/_module.less
This is important file to run slick slider properly in Magento 2 without any issues.
Content for this file is..
@import 'slick.less';
@import 'slick-theme.less';
routes.xml file here..app/code/Mage2sk/SlickSlider/etc/frontend/routes.xml
Content for this file is ..
<?xml version="1.0"?>
<!--
/**
* Mage2sk Use Slick slider in Magento 2
*
* @package Mage2sk_SlickSlider
* @author Kishan Savaliya <kishansavaliyakb@gmail.com>
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="magehelper_slickslider" frontName="magehelper_slickslider">
<module name="Mage2sk_SlickSlider" />
</route>
</router>
</config>
app/code/Mage2sk/SlickSlider/Controller/Index/Index.php
And content for this file is :
<?php
/**
* Mage2sk Use Slick slider in Magento 2
*
* @package Mage2sk_SlickSlider
* @author Kishan Savaliya <kishansavaliyakb@gmail.com>
*/
namespace Mage2sk\SlickSlider\Controller\Index;
class Index extends \Magento\Framework\App\Action\Action
{
protected $resultPageFactory;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
){
$this->resultPageFactory = $resultPageFactory;
return parent::__construct($context);
}
public function execute()
{
$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle()->prepend(__('Mage2sk Slick slider demo'));
return $resultPage;
}
}
app/code/Mage2sk/SlickSlider/view/frontend/layout/magehelper_slickslider_index_index.xml
Content for this file is ...
<?xml version="1.0"?>
<!--
/**
* Mage2sk Use Slick slider in Magento 2
*
* @package Mage2sk_SlickSlider
* @author Kishan Savaliya <kishansavaliyakb@gmail.com>
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<referenceContainer name="content">
<block
template="Mage2sk_SlickSlider::slick-slider.phtml"
class="Magento\Framework\View\Element\Template"
name="magento-2-slick-slider-demo"/>
</referenceContainer>
</page>
app/code/Mage2sk/SlickSlider/view/frontend/templates/slick-slider.phtml
Add Content in phtml file..
php bin/magento setup:upgrade
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:static-content:deploy -f
Hope this article will helpful to you!!
| Module Category | Theme & UI |
|---|---|
| Best For | All Sizes |
Talk to Kishan directly — written quote, scope and timeline within 24 hours. No sales call.
Slick Slider Integration for Magento 2