From c419f66bcb760ce690d1267afe90d6845d6cae39 Mon Sep 17 00:00:00 2001 From: "m.rainko" Date: Wed, 11 Mar 2026 14:57:15 +0100 Subject: [PATCH 1/3] optimize assets, replace time() with version-based cache busting and remove unused deps --- web/app/mu-plugins/juniper-commands.php | 6 +- web/app/themes/juniper-theme/.bootstraprc | 125 ------------ .../juniper-theme/blocks/cta/functions.php | 6 +- .../blocks/filteringposts/functions.php | 18 +- web/app/themes/juniper-theme/composer.json | 2 +- web/app/themes/juniper-theme/functions.php | 6 +- web/app/themes/juniper-theme/package.json | 8 - web/app/themes/juniper-theme/patterns/cta.php | 2 +- .../themes/juniper-theme/src/css/_app.scss | 1 - .../juniper-theme/src/css/vendor/swiper.scss | 193 ------------------ .../src/js/animations/transitions.js | 23 --- 11 files changed, 26 insertions(+), 364 deletions(-) delete mode 100644 web/app/themes/juniper-theme/.bootstraprc delete mode 100644 web/app/themes/juniper-theme/src/css/vendor/swiper.scss delete mode 100644 web/app/themes/juniper-theme/src/js/animations/transitions.js diff --git a/web/app/mu-plugins/juniper-commands.php b/web/app/mu-plugins/juniper-commands.php index be5cc62be..2be234948 100644 --- a/web/app/mu-plugins/juniper-commands.php +++ b/web/app/mu-plugins/juniper-commands.php @@ -208,10 +208,10 @@ public function block( $args, $assoc_args ) { $php = "get( 'Version' );\n" . "\t\$theme_path = get_template_directory_uri();\n\n" . - "\t\twp_enqueue_style('$slug_name-css', \$theme_path . '/dist/blocks/$slug_name/style.css', array(), \$time, 'all');\n" . - "\t\twp_enqueue_script('$slug_name-js', \$theme_path . '/dist/blocks/$slug_name/script.js', array(), \$time, true);\n" . + "\t\twp_enqueue_style('$slug_name-css', \$theme_path . '/dist/blocks/$slug_name/style.css', array(), \$version, 'all');\n" . + "\t\twp_enqueue_script('$slug_name-js', \$theme_path . '/dist/blocks/$slug_name/script.js', array(), \$version, true);\n" . "\t}\n" . "});\n\n" . "add_action('admin_init', function() {\n" . diff --git a/web/app/themes/juniper-theme/.bootstraprc b/web/app/themes/juniper-theme/.bootstraprc deleted file mode 100644 index 6d666cce4..000000000 --- a/web/app/themes/juniper-theme/.bootstraprc +++ /dev/null @@ -1,125 +0,0 @@ ---- -# Output debugging info -# loglevel: debug - -# Major version of Bootstrap: 3 or 4 -bootstrapVersion: 3 - -# If Bootstrap version 3 is used - turn on/off custom icon font path -useCustomIconFontPath: false - -# Webpack loaders, order matters -styleLoaders: - - style-loader - - css-loader - - sass-loader - -# Extract styles to stand-alone css file -# Different settings for different environments can be used, -# It depends on value of NODE_ENV environment variable -# This param can also be set in webpack config: -# entry: 'bootstrap-loader/extractStyles' -extractStyles: false -# env: -# development: -# extractStyles: false -# production: -# extractStyles: true - -# Customize Bootstrap variables that get imported before the original Bootstrap variables. -# Thus original Bootstrap variables can depend on values from here. All the bootstrap -# variables are configured with !default, and thus, if you define the variable here, then -# that value is used, rather than the default. However, many bootstrap variables are derived -# from other bootstrap variables, and thus, you want to set this up before we load the -# official bootstrap versions. -# For example, _variables.scss contains: -# $input-color: $gray !default; -# This means you can define $input-color before we load _variables.scss -preBootstrapCustomizations: ./src/style/bootstrap/pre-customizations.scss - -# This gets loaded after bootstrap/variables is loaded and before bootstrap is loaded. -# A good example of this is when you want to override a bootstrap variable to be based -# on the default value of bootstrap. This is pretty specialized case. Thus, you normally -# just override bootrap variables in preBootstrapCustomizations so that derived -# variables will use your definition. -# -# For example, in _variables.scss: -# $input-height: (($font-size-base * $line-height) + ($input-padding-y * 2) + ($border-width * 2)) !default; -# This means that you could define this yourself in preBootstrapCustomizations. Or you can do -# this in bootstrapCustomizations to make the input height 10% bigger than the default calculation. -# Thus you can leverage the default calculations. -# $input-height: $input-height * 1.10; -# bootstrapCustomizations: ./app/styles/bootstrap/customizations.scss - -# Import your custom styles here. You have access to all the bootstrap variables. If you require -# your sass files separately, you will not have access to the bootstrap variables, mixins, clases, etc. -# Usually this endpoint-file contains list of @imports of your application styles. -# appStyles: ./app/styles/app.scss - -### Bootstrap styles -styles: - - # Mixins - mixins: true - - # Reset and dependencies - normalize: true - print: true - glyphicons: false - - # Core CSS - scaffolding: true - type: true - code: false - grid: true - tables: false - forms: true - buttons: false - - # Components - component-animations: true - dropdowns: true - button-groups: true - input-groups: false - navs: true - navbar: true - breadcrumbs: false - pagination: false - pager: false - labels: false - badges: false - jumbotron: false - thumbnails: false - alerts: false - progress-bars: false - media: true - list-group: false - panels: false - wells: false - responsive-embed: true - close: false - - # Components w/ JavaScript - modals: true - tooltip: false - popovers: false - carousel: true - - # Utility classes - utilities: true - responsive-utilities: true - -### Bootstrap scripts -scripts: - transition: true - alert: false - button: false - carousel: false - collapse: false - dropdown: true - modal: false - tooltip: false - popover: false - scrollspy: false - tab: false - affix: false \ No newline at end of file diff --git a/web/app/themes/juniper-theme/blocks/cta/functions.php b/web/app/themes/juniper-theme/blocks/cta/functions.php index 9a1928b9e..296b762db 100644 --- a/web/app/themes/juniper-theme/blocks/cta/functions.php +++ b/web/app/themes/juniper-theme/blocks/cta/functions.php @@ -4,11 +4,11 @@ 'wp_enqueue_scripts', function() { if ( has_block( 'acf/cta' ) ) { - $time = time(); + $version = wp_get_theme()->get( 'Version' ); $theme_path = get_template_directory_uri(); - wp_enqueue_style( 'cta-css', $theme_path . '/dist/blocks/cta/style.css', array(), $time, 'all' ); - wp_enqueue_script( 'cta-js', $theme_path . '/dist/blocks/cta/script.js', array(), $time, true ); + wp_enqueue_style( 'cta-css', $theme_path . '/dist/blocks/cta/style.css', array(), $version, 'all' ); + wp_enqueue_script( 'cta-js', $theme_path . '/dist/blocks/cta/script.js', array(), $version, true ); } } ); diff --git a/web/app/themes/juniper-theme/blocks/filteringposts/functions.php b/web/app/themes/juniper-theme/blocks/filteringposts/functions.php index 9c72df606..866706564 100644 --- a/web/app/themes/juniper-theme/blocks/filteringposts/functions.php +++ b/web/app/themes/juniper-theme/blocks/filteringposts/functions.php @@ -4,15 +4,27 @@ 'wp_enqueue_scripts', function() { if ( has_block( 'acf/filteringposts' ) ) { - wp_enqueue_style( 'filteringposts-css', get_template_directory_uri() . '/dist/blocks/filteringposts/style.css', array(), time(), 'all' ); - wp_enqueue_script( 'filteringposts-js', get_template_directory_uri() . '/dist/blocks/filteringposts/script.js', array(), time(), true ); + $version = wp_get_theme()->get( 'Version' ); + $theme_path = get_template_directory_uri(); + + wp_enqueue_style( 'filteringposts-css', $theme_path . '/dist/blocks/filteringposts/style.css', array(), $version, 'all' ); + wp_enqueue_script( 'filteringposts-js', $theme_path . '/dist/blocks/filteringposts/script.js', array(), $version, true ); } } ); +add_action( + 'admin_init', + function() { + add_editor_style( '/dist/blocks/filteringposts/style.css' ); + } +); + add_filter( 'timber/acf-gutenberg-blocks-data/filteringposts', - function( $context ) {} + function( $context ) { + return $context; + } ); $block_name = 'filteringposts'; diff --git a/web/app/themes/juniper-theme/composer.json b/web/app/themes/juniper-theme/composer.json index 2b0f62937..b5fdb3d69 100644 --- a/web/app/themes/juniper-theme/composer.json +++ b/web/app/themes/juniper-theme/composer.json @@ -15,7 +15,7 @@ "require": { "php": ">=8.1", "timber/timber": "^2.0", - "bartnovak/timber-acf-wp-blocks": "^0.1.0" + "bartnovak/timber-acf-wp-blocks": "^0.2.0" }, "config": { "optimize-autoloader": true, diff --git a/web/app/themes/juniper-theme/functions.php b/web/app/themes/juniper-theme/functions.php index f75d611f0..7fb6fff9c 100644 --- a/web/app/themes/juniper-theme/functions.php +++ b/web/app/themes/juniper-theme/functions.php @@ -23,11 +23,11 @@ require_once 'inc/include.php'; function juniper_theme_enqueue() { - $refresh_cache_time = time(); + $version = wp_get_theme()->get( 'Version' ); $template_directory_uri = get_template_directory_uri(); - wp_enqueue_style( 'app-css', $template_directory_uri . '/dist/src/css/_app.css', array(), $refresh_cache_time ); - wp_enqueue_script( 'app-js', $template_directory_uri . '/dist/src/js/_app.js', array(), $refresh_cache_time, true ); + wp_enqueue_style( 'app-css', $template_directory_uri . '/dist/src/css/_app.css', array(), $version ); + wp_enqueue_script( 'app-js', $template_directory_uri . '/dist/src/js/_app.js', array(), $version, true ); } add_action( 'wp_enqueue_scripts', 'juniper_theme_enqueue' ); diff --git a/web/app/themes/juniper-theme/package.json b/web/app/themes/juniper-theme/package.json index 8afb231ee..da3394c8d 100644 --- a/web/app/themes/juniper-theme/package.json +++ b/web/app/themes/juniper-theme/package.json @@ -2,13 +2,7 @@ "name": "parcel-juniper-theme", "version": "1.0.0", "dependencies": { - "@barba/core": "^2.10", - "@barba/prefetch": "^2.2", - "bootstrap": "^5.3", "cypress": "^15.6", - "gsap": "^3.13.0", - "imagesloaded": "^5.0", - "jquery": "^3.7", "postcss": "^8.5" }, "devDependencies": { @@ -16,8 +10,6 @@ "browserslist": "^4.28", "eslint": "^8.56", "eslint-config-airbnb-base": "^15.0", - "husky": "^9.1", - "litepicker": "^2.0", "parcel": "^2.16", "sass": "^1.94" }, diff --git a/web/app/themes/juniper-theme/patterns/cta.php b/web/app/themes/juniper-theme/patterns/cta.php index 3063b9673..981e943a7 100644 --- a/web/app/themes/juniper-theme/patterns/cta.php +++ b/web/app/themes/juniper-theme/patterns/cta.php @@ -10,7 +10,7 @@
-

Testing 123123

+

Testing

diff --git a/web/app/themes/juniper-theme/src/css/_app.scss b/web/app/themes/juniper-theme/src/css/_app.scss index 9eaa26447..a17da3145 100644 --- a/web/app/themes/juniper-theme/src/css/_app.scss +++ b/web/app/themes/juniper-theme/src/css/_app.scss @@ -1,2 +1 @@ @use 'base'; -@use 'vendor/swiper'; \ No newline at end of file diff --git a/web/app/themes/juniper-theme/src/css/vendor/swiper.scss b/web/app/themes/juniper-theme/src/css/vendor/swiper.scss deleted file mode 100644 index c80bf0c15..000000000 --- a/web/app/themes/juniper-theme/src/css/vendor/swiper.scss +++ /dev/null @@ -1,193 +0,0 @@ -:root { - --swiper-theme-color: #333; -} - -.swiper-container { - margin-left: auto; - margin-right: auto; - position: relative; - overflow: hidden; - list-style: none; - padding: 0; - /* Fix of Webkit flickering */ - z-index: 1; - width: 100%; -} - -.swiper-container-vertical>.swiper-wrapper { - flex-direction: column; -} - -.swiper-wrapper { - position: relative; - width: 100%; - height: 100%; - z-index: 1; - display: flex; - transition-property: transform; - box-sizing: content-box; -} - -.swiper-container-android .swiper-slide, -.swiper-wrapper { - transform: translate3d(0px, 0, 0); -} - -.swiper-container-multirow>.swiper-wrapper { - flex-wrap: wrap; -} - -.swiper-container-multirow-column>.swiper-wrapper { - flex-wrap: wrap; - flex-direction: column; -} - -.swiper-container-free-mode>.swiper-wrapper { - transition-timing-function: ease-out; - margin: 0 auto; -} - -.swiper-slide { - flex-shrink: 0; - width: 100%; - height: 100%; - position: relative; - transition-property: transform; -} - -.swiper-slide-invisible-blank { - visibility: hidden; -} - -/* Auto Height */ -.swiper-container-autoheight { - - &, - .swiper-slide { - height: auto; - } - - .swiper-wrapper { - align-items: flex-start; - transition-property: transform, height; - } -} - -/* 3D Effects */ -.swiper-container-3d { - perspective: 1200px; - - .swiper-wrapper, - .swiper-slide, - .swiper-slide-shadow-left, - .swiper-slide-shadow-right, - .swiper-slide-shadow-top, - .swiper-slide-shadow-bottom, - .swiper-cube-shadow { - transform-style: preserve-3d; - } - - .swiper-slide-shadow-left, - .swiper-slide-shadow-right, - .swiper-slide-shadow-top, - .swiper-slide-shadow-bottom { - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 100%; - pointer-events: none; - z-index: 10; - } - - .swiper-slide-shadow-left { - background-image: linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); - } - - .swiper-slide-shadow-right { - background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); - } - - .swiper-slide-shadow-top { - background-image: linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); - } - - .swiper-slide-shadow-bottom { - background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)); - } -} - -/* CSS Mode */ -.swiper-container-css-mode { - >.swiper-wrapper { - overflow: auto; - scrollbar-width: none; - /* For Firefox */ - -ms-overflow-style: none; - - /* For Internet Explorer and Edge */ - &::-webkit-scrollbar { - display: none; - } - } - - >.swiper-wrapper>.swiper-slide { - scroll-snap-align: start start; - } -} - -.swiper-container-horizontal.swiper-container-css-mode { - >.swiper-wrapper { - scroll-snap-type: x mandatory; - } -} - -.swiper-container-vertical.swiper-container-css-mode { - >.swiper-wrapper { - scroll-snap-type: y mandatory; - } -} - -.swiper-button { - height: 10px; - - &-next, - &-prev { - width: 30px; - height: 30px; - background: #ccc; - position: absolute; - top: 50%; - transform: translateY(-50%); - z-index: 2; - cursor: pointer; - } - - &-prev { - left: 5%; - } - - &-next { - right: 5%; - } -} - -.swiper-pagination { - position: absolute; - bottom: 20px; - left: 20px; - z-index: 2; - display: flex; - - &-bullet { - display: block; - width: 10px; - height: 10px; - background: #ccc; - margin-right: 5px; - - &-active { - background: red; - } - } -} \ No newline at end of file diff --git a/web/app/themes/juniper-theme/src/js/animations/transitions.js b/web/app/themes/juniper-theme/src/js/animations/transitions.js deleted file mode 100644 index 1f7fd2e06..000000000 --- a/web/app/themes/juniper-theme/src/js/animations/transitions.js +++ /dev/null @@ -1,23 +0,0 @@ -import barba from '@barba/core'; -import barbaPrefetch from '@barba/prefetch'; -import App from '../_app'; - -export default function () { - barba.use(barbaPrefetch); - barba.init({ - transitions: [{ - leave(data) { // eslint-disable-line no-unused-vars - const done = this.async(); - done(); - document.body.classList.remove('nav--toggled'); - document.querySelector('header').scrollTo({ behavior: 'smooth' }); - }, - enter(data) { // eslint-disable-line no-unused-vars - const done = this.async(); - done(); // call on transition end - - App(); // reinit everything inside .main - }, - }], - }); -} From bb24bb7a7e9da106cb87d269cb18c98c6f87c76b Mon Sep 17 00:00:00 2001 From: "m.rainko" Date: Wed, 11 Mar 2026 15:02:54 +0100 Subject: [PATCH 2/3] phpcs --- web/app/themes/juniper-theme/blocks/cta/functions.php | 2 +- .../themes/juniper-theme/blocks/filteringposts/functions.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/themes/juniper-theme/blocks/cta/functions.php b/web/app/themes/juniper-theme/blocks/cta/functions.php index 296b762db..b66f61347 100644 --- a/web/app/themes/juniper-theme/blocks/cta/functions.php +++ b/web/app/themes/juniper-theme/blocks/cta/functions.php @@ -4,7 +4,7 @@ 'wp_enqueue_scripts', function() { if ( has_block( 'acf/cta' ) ) { - $version = wp_get_theme()->get( 'Version' ); + $version = wp_get_theme()->get( 'Version' ); $theme_path = get_template_directory_uri(); wp_enqueue_style( 'cta-css', $theme_path . '/dist/blocks/cta/style.css', array(), $version, 'all' ); diff --git a/web/app/themes/juniper-theme/blocks/filteringposts/functions.php b/web/app/themes/juniper-theme/blocks/filteringposts/functions.php index 866706564..beb1bfe06 100644 --- a/web/app/themes/juniper-theme/blocks/filteringposts/functions.php +++ b/web/app/themes/juniper-theme/blocks/filteringposts/functions.php @@ -4,7 +4,7 @@ 'wp_enqueue_scripts', function() { if ( has_block( 'acf/filteringposts' ) ) { - $version = wp_get_theme()->get( 'Version' ); + $version = wp_get_theme()->get( 'Version' ); $theme_path = get_template_directory_uri(); wp_enqueue_style( 'filteringposts-css', $theme_path . '/dist/blocks/filteringposts/style.css', array(), $version, 'all' ); From 86aa1da16b71d24b6bc9020e39e2c2ccdca5e92b Mon Sep 17 00:00:00 2001 From: "m.rainko" Date: Wed, 11 Mar 2026 15:03:40 +0100 Subject: [PATCH 3/3] remove testing class --- web/app/themes/juniper-theme/patterns/cta.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/themes/juniper-theme/patterns/cta.php b/web/app/themes/juniper-theme/patterns/cta.php index 981e943a7..757341f98 100644 --- a/web/app/themes/juniper-theme/patterns/cta.php +++ b/web/app/themes/juniper-theme/patterns/cta.php @@ -10,7 +10,7 @@
-

Testing

+

Testing