From 1f046109c2f658231da6d08ab49e1359fd2a970f Mon Sep 17 00:00:00 2001 From: Fabiano Date: Fri, 29 Jun 2018 14:33:49 -0300 Subject: [PATCH] Implement Slick Slider to Tainacan Theme. --- build.sh | 8 +++++++- compile-sass.sh | 13 +++++++++++-- install.sh | 13 +++++++++++-- src/functions/enqueues.php | 20 ++++++++++++++++---- 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index 408129b..201b9c6 100755 --- a/build.sh +++ b/build.sh @@ -21,4 +21,10 @@ mkdir $destination/assets/vendor/bootstrap/css cp $destination/assets/vendor/bootstrap/scss/bootstrap.min.css $destination/assets/vendor/bootstrap/css/bootstrap.min.css rm -rf $destination/assets/vendor/bootstrap/scss -echo "Finish!!" \ No newline at end of file +##Slick +mkdir $destination/assets/vendor/slick/css +cp $destination/assets/vendor/slick/scss/slick.min.css $destination/assets/vendor/slick/css/slick.min.css +cp $destination/assets/vendor/slick/scss/slick-theme.min.css $destination/assets/vendor/slick/css/slick-theme.min.css +rm -rf $destination/assets/vendor/slick/scss + +echo "Compilation Finish!!" \ No newline at end of file diff --git a/compile-sass.sh b/compile-sass.sh index a01158a..44c32d2 100755 --- a/compile-sass.sh +++ b/compile-sass.sh @@ -16,8 +16,17 @@ echo "Compiling Sass..." #Style do Tema #cd ../../../../assets/scss cd src/assets/scss -sass -E 'UTF-8' style.scss:../../style.css -sass bootstrap_custom.scss:../vendor/bootstrap/scss/bootstrap.min.css +sass -E 'UTF-8' style.scss:../../style.css --style compressed +echo "Style of Tainacan Compiled"; +sass bootstrap_custom.scss:../vendor/bootstrap/scss/bootstrap.min.css --style compressed +echo "Bootstrap Compiled"; +rm -rf .sass-cache +cd ../vendor/slick/scss +sass slick.scss:slick.min.css --style compressed +sass slick-theme.scss:slick-theme.min.css --style compressed +echo "Slick for slider carousel Compiled"; +rm -rf slick-theme.min.css.map slick.min.css.map .sass-cache/ +cd ../../../scss rm -rf ../../style.css.map echo "Sass compilation Completed!" diff --git a/install.sh b/install.sh index 504ade0..58a9371 100644 --- a/install.sh +++ b/install.sh @@ -12,7 +12,7 @@ if (!file_exists("src/assets/bootstrap")) { mkdir("src/assets/vendor/bootstrap/js", 0777, true); } -echo "\m Checking if file bootstrap navwalker exist ... \n\n"; +echo "\n Checking if file bootstrap navwalker exist ... \n\n"; if (!file_exists("src/vendor/class-wp-bootstrap-navwalker.php")) { echo "\m Copy Boostrap Navwalker ... \n\n"; @@ -27,8 +27,17 @@ echo "...Bootstrap\n"; copy("vendor/twbs/bootstrap/dist/js/bootstrap.min.js", "src/assets/vendor/bootstrap/js/bootstrap.min.js"); copy("vendor/twbs/bootstrap/assets/js/vendor/popper.min.js", "src/assets/vendor/bootstrap/js/popper.min.js"); +echo "Copy Slick for Slider...\n\n"; + if (!file_exists("src/assets/vendor/slick")) { + mkdir("src/assets/vendor/slick/", 0777, true); + mkdir("src/assets/vendor/slick/scss", 0777, true); + mkdir("src/assets/vendor/slick/js", 0777, true); + } + copy("vendor/kenwheeler/slick/slick/slick-theme.scss", "src/assets/vendor/slick/scss/slick-theme.scss"); + copy("vendor/kenwheeler/slick/slick/slick.scss", "src/assets/vendor/slick/scss/slick.scss"); + copy("vendor/kenwheeler/slick/slick/slick.min.js", "src/assets/vendor/slick/js/slick.min.js"); -echo "Finish!\n\n"; +echo "Finish Copy files! \n\n"; function recurse_copy($src,$dst) { $dir = opendir($src); diff --git a/src/functions/enqueues.php b/src/functions/enqueues.php index 4232995..22ff7d5 100644 --- a/src/functions/enqueues.php +++ b/src/functions/enqueues.php @@ -18,18 +18,30 @@ if ( ! function_exists('tainacan_Enqueues') ) { wp_register_script('masonryJS', 'https://unpkg.com/masonry-layout@4.2.1/dist/masonry.pkgd.min.js', '', '4.2.1', true); wp_enqueue_script( 'masonryJS' ); /** - * Bootstrap 4 + * Bootstrap 4.1.1 */ //Style - wp_register_style('bootstrap4CSS', get_template_directory_uri() . '/assets/vendor/bootstrap/css/bootstrap.min.css', '', '4.0.0', ''); + wp_register_style('bootstrap4CSS', get_template_directory_uri() . '/assets/vendor/bootstrap/css/bootstrap.min.css', '', '4.1.1', ''); wp_enqueue_style('bootstrap4CSS'); //Javascript - wp_register_script('bootstrap4JS', get_template_directory_uri() . '/assets/vendor/bootstrap/js/bootstrap.min.js', array('jquery'), '4.0.0', true); + wp_register_script('bootstrap4JS', get_template_directory_uri() . '/assets/vendor/bootstrap/js/bootstrap.min.js', array('jquery'), '4.1.1', true); wp_enqueue_script('bootstrap4JS'); //Popper wp_register_script('popper_bootstrap4', get_template_directory_uri() . '/assets/vendor/bootstrap/js/popper.min.js', '', '', true); wp_enqueue_script('popper_bootstrap4'); - + + /** + * Slick Slider Carousel + */ + //Styles + wp_register_style('SlickCss', get_template_directory_uri() . '/assets/vendor/slick/css/slick.min.css', '', '1.6.1', ''); + wp_register_style('SlickThemeCss', get_template_directory_uri() . '/assets/vendor/slick/css/slick-theme.min.css', '', '1.6.1', ''); + wp_enqueue_style('SlickCss'); + wp_enqueue_style('SlickThemeCss'); + //Javascript + wp_register_script('SlickJS', get_template_directory_uri() . '/assets/vendor/slick/js/slick.min.js', array('jquery'), '1.6.1', true); + wp_enqueue_script('SlickJS'); + /** * Google */