Skip to content

optimize assets, replace time() with version-based cache busting and …#27

Merged
bartnovak merged 3 commits into
masterfrom
fix/optimize_theme_dependencies
Mar 12, 2026
Merged

optimize assets, replace time() with version-based cache busting and …#27
bartnovak merged 3 commits into
masterfrom
fix/optimize_theme_dependencies

Conversation

@rainkom

@rainkom rainkom commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Refactor

    • Removed page transition system with smooth animations.
    • Removed carousel library and its styling.
    • Switched asset versioning to use the theme version for cache control.
  • Chores

    • Removed several frontend dependencies and cleaned up configuration.
  • Bug Fixes / UX

    • Restored block editor styling for a posts-filter block.
    • Minor update to CTA heading text.

@coderabbitai

coderabbitai Bot commented Mar 11, 2026

Copy link
Copy Markdown

Walkthrough

Replace time-based cache-busting with theme version; remove Bootstrap config, Swiper styles, Barba transitions and several frontend dependencies; add editor stylesheet registration and return context for filteringposts block; bump timber-acf-wp-blocks dependency and adjust a CTA pattern heading.

Changes

Cohort / File(s) Summary
Asset cache-busting
web/app/mu-plugins/juniper-commands.php, web/app/themes/juniper-theme/blocks/cta/functions.php, web/app/themes/juniper-theme/blocks/filteringposts/functions.php, web/app/themes/juniper-theme/functions.php
Replaced dynamic time()-based versioning with theme version via wp_get_theme()->get('Version') for enqueued CSS/JS.
Filteringposts block edits
web/app/themes/juniper-theme/blocks/filteringposts/functions.php
Added admin_init hook to register an editor stylesheet and updated the timber/acf-gutenberg-blocks-data/filteringposts filter to return the provided $context.
Bootstrap config removal
web/app/themes/juniper-theme/.bootstraprc
Deleted Bootstrap configuration file and all bootstrap-related customization/load/extraction settings.
Frontend deps removed
web/app/themes/juniper-theme/package.json
Removed multiple frontend dependencies and devDeps (e.g., @barba/*, bootstrap, gsap, imagesloaded, jquery, husky, litepicker).
Barba transitions removed
web/app/themes/juniper-theme/src/js/animations/transitions.js
Deleted Barba.js-based page transition module and its default export.
Swiper styles removed
web/app/themes/juniper-theme/src/css/vendor/swiper.scss, web/app/themes/juniper-theme/src/css/_app.scss
Deleted Swiper SCSS file and removed its import from the main SCSS entry.
Dependency bump
web/app/themes/juniper-theme/composer.json
Bumped bartnovak/timber-acf-wp-blocks requirement from ^0.1.0 to ^0.2.0.
Minor pattern change
web/app/themes/juniper-theme/patterns/cta.php
Adjusted CTA heading class/text from "wp-block-heading asddsa" / "Testing 123123" to "wp-block-heading" / "Testing".
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title partially captures the main change (replacing time() with version-based caching) but omits other significant changes like dependency cleanup and removal of Barba/Swiper libraries.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/optimize_theme_dependencies

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/app/mu-plugins/juniper-commands.php (1)

211-218: ⚠️ Potential issue | 🟡 Minor

Indentation inconsistency in generated block template.

Line 211 uses single tab (\t$version) but should use double tabs to match lines 213-214. Also line 223 (\treturn) should align with the function body.

Proposed fix
-				"\t\$version    = wp_get_theme()->get( 'Version' );\n" .
-				"\t\$theme_path = get_template_directory_uri();\n\n" .
+				"\t\t\$version    = wp_get_theme()->get( 'Version' );\n" .
+				"\t\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(), \$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" .
-				"\t\tadd_editor_style('/dist/blocks/$slug_name/style.css');\n" .
+				"add_action('admin_init', function() {\n" .
+				"\tadd_editor_style('/dist/blocks/$slug_name/style.css');\n" .
 				"});\n\n" .
 				"add_filter(\n" .
 				"\t'timber/acf-gutenberg-blocks-data/$slug_name',\n" .
 				"\tfunction( \$context ) {\n" .
-				"\treturn \$context;\n" .
+				"\t\treturn \$context;\n" .
 				'});';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/app/mu-plugins/juniper-commands.php` around lines 211 - 218, The
generated block template has inconsistent indentation: change the single-tab
lines (e.g. the "$version = wp_get_theme()->get( 'Version' );" and "$theme_path
= get_template_directory_uri();" lines inside the add_action closure to use two
tabs so they align with the subsequent wp_enqueue_style/wp_enqueue_script lines,
and adjust the "return" line (inside the same function/closure) to align with
the function body indentation; locate the closure registered with
add_action(...) that contains $version, $theme_path,
wp_enqueue_style/wp_enqueue_script and ensure all lines in that closure use
consistent double-tab indentation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/app/themes/juniper-theme/blocks/cta/functions.php`:
- Around line 7-8: The assignments in functions.php use aligned equals which
triggers PHPCS; update the two lines that set $version and $theme_path so they
use standard single-space assignment formatting (e.g., $version = ...;
$theme_path = ...;) in the cta block, ensuring spacing around the '=' is
consistent with PHPCS rules and matches the change already applied in
filteringposts/functions.php.

In `@web/app/themes/juniper-theme/blocks/filteringposts/functions.php`:
- Around line 7-8: Align the assignment operators for the variables by making
the spacing before the equals sign consistent: adjust the $theme_path assignment
so its equals sign lines up with $version (e.g., change "$theme_path =
get_template_directory_uri();" to match the spacing pattern used in "$version   
= wp_get_theme()->get( 'Version' );"), ensuring both $version and $theme_path
use the same alignment and adhere to PHPCS spacing rules.

In `@web/app/themes/juniper-theme/patterns/cta.php`:
- Line 13: Remove the stray debug class "asddsa" from the h2 element's class
list (the element currently rendered as <h2 class="wp-block-heading
asddsa">Testing</h2>) so it becomes only the intended class (e.g.,
"wp-block-heading"); search for any other occurrences of "asddsa" in the CTA
pattern and delete them to avoid leaving debug artifacts, then validate the
markup renders and run your theme linter/formatter.

---

Outside diff comments:
In `@web/app/mu-plugins/juniper-commands.php`:
- Around line 211-218: The generated block template has inconsistent
indentation: change the single-tab lines (e.g. the "$version =
wp_get_theme()->get( 'Version' );" and "$theme_path =
get_template_directory_uri();" lines inside the add_action closure to use two
tabs so they align with the subsequent wp_enqueue_style/wp_enqueue_script lines,
and adjust the "return" line (inside the same function/closure) to align with
the function body indentation; locate the closure registered with
add_action(...) that contains $version, $theme_path,
wp_enqueue_style/wp_enqueue_script and ensure all lines in that closure use
consistent double-tab indentation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 90d0eb84-d190-4651-8b6e-fc8c21cc15b1

📥 Commits

Reviewing files that changed from the base of the PR and between 1ddc03c and c419f66.

📒 Files selected for processing (11)
  • web/app/mu-plugins/juniper-commands.php
  • web/app/themes/juniper-theme/.bootstraprc
  • web/app/themes/juniper-theme/blocks/cta/functions.php
  • web/app/themes/juniper-theme/blocks/filteringposts/functions.php
  • web/app/themes/juniper-theme/composer.json
  • web/app/themes/juniper-theme/functions.php
  • web/app/themes/juniper-theme/package.json
  • web/app/themes/juniper-theme/patterns/cta.php
  • web/app/themes/juniper-theme/src/css/_app.scss
  • web/app/themes/juniper-theme/src/css/vendor/swiper.scss
  • web/app/themes/juniper-theme/src/js/animations/transitions.js
💤 Files with no reviewable changes (5)
  • web/app/themes/juniper-theme/src/css/_app.scss
  • web/app/themes/juniper-theme/package.json
  • web/app/themes/juniper-theme/src/js/animations/transitions.js
  • web/app/themes/juniper-theme/src/css/vendor/swiper.scss
  • web/app/themes/juniper-theme/.bootstraprc

Comment thread web/app/themes/juniper-theme/blocks/cta/functions.php Outdated
Comment thread web/app/themes/juniper-theme/blocks/filteringposts/functions.php Outdated
Comment thread web/app/themes/juniper-theme/patterns/cta.php Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
web/app/themes/juniper-theme/blocks/filteringposts/functions.php (1)

16-21: Consider using after_setup_theme hook instead of admin_init.

add_editor_style() is typically called during theme setup. Using admin_init works but runs on every admin page load. The after_setup_theme hook is the conventional choice.

Suggested change
-add_action(
-	'admin_init',
-	function() {
-		add_editor_style( '/dist/blocks/filteringposts/style.css' );
-	}
-);
+add_action(
+	'after_setup_theme',
+	function() {
+		add_editor_style( '/dist/blocks/filteringposts/style.css' );
+	}
+);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/app/themes/juniper-theme/blocks/filteringposts/functions.php` around
lines 16 - 21, The code currently hooks an anonymous function calling
add_editor_style() to admin_init; change the hook to after_setup_theme so
add_editor_style() runs during theme setup instead of on every admin page
load—update the add_action(...) call to use 'after_setup_theme' (keeping the
same anonymous callback that calls
add_editor_style('/dist/blocks/filteringposts/style.css')) so the symbol
add_action, the anonymous callback, and add_editor_style are preserved but
executed at the proper lifecycle hook.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/app/themes/juniper-theme/blocks/filteringposts/functions.php`:
- Around line 16-21: The code currently hooks an anonymous function calling
add_editor_style() to admin_init; change the hook to after_setup_theme so
add_editor_style() runs during theme setup instead of on every admin page
load—update the add_action(...) call to use 'after_setup_theme' (keeping the
same anonymous callback that calls
add_editor_style('/dist/blocks/filteringposts/style.css')) so the symbol
add_action, the anonymous callback, and add_editor_style are preserved but
executed at the proper lifecycle hook.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 03d5c50a-6050-4532-8f24-07cc4ac63da4

📥 Commits

Reviewing files that changed from the base of the PR and between c419f66 and 86aa1da.

📒 Files selected for processing (3)
  • web/app/themes/juniper-theme/blocks/cta/functions.php
  • web/app/themes/juniper-theme/blocks/filteringposts/functions.php
  • web/app/themes/juniper-theme/patterns/cta.php
🚧 Files skipped from review as they are similar to previous changes (2)
  • web/app/themes/juniper-theme/blocks/cta/functions.php
  • web/app/themes/juniper-theme/patterns/cta.php

@bartnovak
bartnovak merged commit c2ccf98 into master Mar 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants