Add slick as a dependency in Sage’s bower.js:
"dependencies": {
"slick-carousel": "~1.6.0",
...
Then add this to the overrides
section in Sage’s bower.js:
"overrides":{
"slick-carousel": {
"main": [
"./slick/slick.min.js",
"./slick/slick.css",
"./slick/slick-theme.css",
"./slick/fonts/*"
]
}
...
(After this step be sure to run bower update
.)
Be sure to have these lines in your manifest.js:
{
"dependencies": {
"main.js": {
"bower": ["slick-carousel"],
"files": [
"scripts/main.js"
],
"main": true
},
"main.css": {
"bower": ["slick-carousel"],
"files": [
"styles/main.scss"
],
"main": true
},
then of course you need to call Slick from inside your main.js:
var Sage = {
// All pages
'common': {
init: function() {
// JavaScript to be fired on all pages
$('.slick-carousel').slick();
},
finalize: function() {
// JavaScript to be fired on all pages, after page specific JS is fired
}
},
To see Slick it in action, add some markup to one of your templates:
<div class="slick-carousel" data-slick='{"slidesToShow": 4, "slidesToScroll": 4}'>
<div><h3>1</h3></div>
<div><h3>2</h3></div>
<div><h3>3</h3></div>
<div><h3>4</h3></div>
<div><h3>5</h3></div>
<div><h3>6</h3></div>
</div>
After this, be sure to run gulp
. And then go see what you have on your site. 