optimize assets, replace time() with version-based cache busting and …#27
Conversation
…remove unused deps
WalkthroughReplace 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
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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 | 🟡 MinorIndentation 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
📒 Files selected for processing (11)
web/app/mu-plugins/juniper-commands.phpweb/app/themes/juniper-theme/.bootstraprcweb/app/themes/juniper-theme/blocks/cta/functions.phpweb/app/themes/juniper-theme/blocks/filteringposts/functions.phpweb/app/themes/juniper-theme/composer.jsonweb/app/themes/juniper-theme/functions.phpweb/app/themes/juniper-theme/package.jsonweb/app/themes/juniper-theme/patterns/cta.phpweb/app/themes/juniper-theme/src/css/_app.scssweb/app/themes/juniper-theme/src/css/vendor/swiper.scssweb/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
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/app/themes/juniper-theme/blocks/filteringposts/functions.php (1)
16-21: Consider usingafter_setup_themehook instead ofadmin_init.
add_editor_style()is typically called during theme setup. Usingadmin_initworks but runs on every admin page load. Theafter_setup_themehook 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
📒 Files selected for processing (3)
web/app/themes/juniper-theme/blocks/cta/functions.phpweb/app/themes/juniper-theme/blocks/filteringposts/functions.phpweb/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
Summary by CodeRabbit
Refactor
Chores
Bug Fixes / UX