From 7ae12331ebac5b8741cbf6501eb9c2e16b791657 Mon Sep 17 00:00:00 2001 From: Tiago Noronha Date: Thu, 7 Mar 2019 17:28:29 +0000 Subject: [PATCH] Split Jetpack styles into separate files --- Gruntfile.js | 9 ++-- assets/css/jetpack/infinite-scroll.scss | 18 ++++++++ assets/css/jetpack/jetpack.scss | 54 ------------------------ assets/css/jetpack/widgets.scss | 30 +++++++++++++ inc/jetpack/class-storefront-jetpack.php | 7 ++- 5 files changed, 59 insertions(+), 59 deletions(-) create mode 100644 assets/css/jetpack/infinite-scroll.scss delete mode 100644 assets/css/jetpack/jetpack.scss create mode 100644 assets/css/jetpack/widgets.scss diff --git a/Gruntfile.js b/Gruntfile.js index 57fe4efab..286eb6851 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -28,7 +28,8 @@ module.exports = function( grunt ) { 'assets/css/woocommerce/extensions/*.css', 'assets/css/woocommerce/woocommerce.css', 'assets/css/woocommerce/woocommerce-legacy.css', - 'assets/css/jetpack/jetpack.css', + 'assets/css/jetpack/infinite-scroll.css', + 'assets/css/jetpack/widgets.css', 'assets/css/base/*.css' ] } @@ -165,7 +166,8 @@ module.exports = function( grunt ) { 'assets/css/woocommerce/extensions/quick-view.css': 'assets/css/woocommerce/extensions/quick-view.scss', 'assets/css/woocommerce/woocommerce.css': 'assets/css/woocommerce/woocommerce.scss', 'assets/css/woocommerce/woocommerce-legacy.css': 'assets/css/woocommerce/woocommerce-legacy.scss', - 'assets/css/jetpack/jetpack.css': 'assets/css/jetpack/jetpack.scss', + 'assets/css/jetpack/infinite-scroll.css': 'assets/css/jetpack/infinite-scroll.scss', + 'assets/css/jetpack/widgets.css': 'assets/css/jetpack/widgets.scss', 'assets/css/base/icons.css': 'assets/css/base/icons.scss', 'assets/css/base/gutenberg-blocks.css': 'assets/css/base/gutenberg-blocks.scss', 'assets/css/base/gutenberg-editor.css': 'assets/css/base/gutenberg-editor.scss' @@ -450,7 +452,8 @@ module.exports = function( grunt ) { 'assets/css/woocommerce/woocommerce-legacy.css', 'assets/css/admin/welcome-screen/welcome.css', 'assets/css/admin/customizer/customizer.css', - 'assets/css/jetpack/jetpack.css', + 'assets/css/jetpack/infinite-scroll.css', + 'assets/css/jetpack/widgets.css', 'assets/css/base/icons.css', 'assets/css/base/gutenberg-blocks.css', 'assets/css/base/gutenberg-editor.css' diff --git a/assets/css/jetpack/infinite-scroll.scss b/assets/css/jetpack/infinite-scroll.scss new file mode 100644 index 000000000..ecd6aa6b4 --- /dev/null +++ b/assets/css/jetpack/infinite-scroll.scss @@ -0,0 +1,18 @@ +/** + * Jetpack Infinite Scroll + */ + +/* Globally hidden elements when Infinite Scroll is supported and in use. */ +.paging-navigation, /* Older / Newer Posts Navigation (always hidden) */ +.pagination, +.woocommerce-pagination, +ul.products + .storefront-sorting, +.woocommerce-result-count, +.infinite-scroll.neverending .site-footer { /* Theme Footer (when set to scrolling) */ + display: none; +} + +/* When Infinite Scroll has reached its end we need to re-display elements that were hidden (via .neverending) before */ +.infinity-end.neverending .site-footer { + display: block; +} diff --git a/assets/css/jetpack/jetpack.scss b/assets/css/jetpack/jetpack.scss deleted file mode 100644 index fba421c54..000000000 --- a/assets/css/jetpack/jetpack.scss +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Jetpack - */ - -// Imports -@import 'bourbon'; -@import '../sass/utils/variables'; -@import '../sass/utils/mixins'; -@import '../sass/vendors/modular-scale'; - -/** - * Widgets - */ - -// Subscription widget -.jetpack_subscription_widget { - #subscribe-email { - input { - padding: ms(-2) !important; - width: 100% !important; - } - } -} - -// Google Translate widget -.widget_google_translate_widget { - img { - display: inline; - } - - a { - text-decoration: none !important; - } -} - -/** - * Infinite Scroll - */ - -/* Globally hidden elements when Infinite Scroll is supported and in use. */ -.infinite-scroll .paging-navigation, /* Older / Newer Posts Navigation (always hidden) */ -.infinite-scroll .pagination, -.infinite-scroll .woocommerce-pagination, -.infinite-scroll ul.products + .storefront-sorting, -.infinite-scroll .woocommerce-result-count, -.infinite-scroll.neverending .site-footer, -.infinite-scroll .storefront-sorting { /* Theme Footer (when set to scrolling) */ - display: none; -} - -/* When Infinite Scroll has reached its end we need to re-display elements that were hidden (via .neverending) before */ -.infinity-end.neverending .site-footer { - display: block; -} diff --git a/assets/css/jetpack/widgets.scss b/assets/css/jetpack/widgets.scss new file mode 100644 index 000000000..c4381aba1 --- /dev/null +++ b/assets/css/jetpack/widgets.scss @@ -0,0 +1,30 @@ +/** + * Jetpack Widgets + */ + +// Imports +@import 'bourbon'; +@import '../sass/utils/variables'; +@import '../sass/utils/mixins'; +@import '../sass/vendors/modular-scale'; + +// Subscription widget +.jetpack_subscription_widget { + #subscribe-email { + input { + padding: ms(-2) !important; + width: 100% !important; + } + } +} + +// Google Translate widget +.widget_google_translate_widget { + img { + display: inline; + } + + a { + text-decoration: none !important; + } +} diff --git a/inc/jetpack/class-storefront-jetpack.php b/inc/jetpack/class-storefront-jetpack.php index 4a814da23..d91beef6f 100644 --- a/inc/jetpack/class-storefront-jetpack.php +++ b/inc/jetpack/class-storefront-jetpack.php @@ -101,8 +101,11 @@ public function jetpack_infinite_scroll_wrapper_columns() { public function jetpack_scripts() { global $storefront_version; - wp_enqueue_style( 'storefront-jetpack-style', get_template_directory_uri() . '/assets/css/jetpack/jetpack.css', '', $storefront_version ); - wp_style_add_data( 'storefront-jetpack-style', 'rtl', 'replace' ); + wp_enqueue_style( 'storefront-jetpack-infinite-scroll', get_template_directory_uri() . '/assets/css/jetpack/infinite-scroll.css', array( 'the-neverending-homepage' ), $storefront_version ); + wp_style_add_data( 'storefront-jetpack-infinite-scroll', 'rtl', 'replace' ); + + wp_enqueue_style( 'storefront-jetpack-widgets', get_template_directory_uri() . '/assets/css/jetpack/widgets.css', array(), $storefront_version ); + wp_style_add_data( 'storefront-jetpack-widgets', 'rtl', 'replace' ); } }