Skip to content

Fix build configuration and parallax PHP rendering#9

Draft
Copilot wants to merge 2 commits intoadding-blueprint-parserfrom
copilot/sub-pr-8
Draft

Fix build configuration and parallax PHP rendering#9
Copilot wants to merge 2 commits intoadding-blueprint-parserfrom
copilot/sub-pr-8

Conversation

Copy link
Contributor

Copilot AI commented Nov 21, 2025

Code review identified two critical issues: the main extension code wasn't being built, and parallax effects don't work on dynamic blocks.

Build Configuration

Added webpack.config.js to explicitly configure entry points. Without it, wp-scripts auto-discovery only finds src/progress-block/index.js via its block.json, ignoring src/index.js:

const defaultConfig = require('@wordpress/scripts/config/webpack.config');

module.exports = [
  {
    ...defaultConfig[0],
    entry: {
      index: './src/index.js',
      'progress-block/index': './src/progress-block/index.js',
    },
  },
  ...defaultConfig.slice(1),
];

Parallax PHP Support

Extended render_block filter to handle parallaxEnabled and parallaxStrength attributes. Previously only processed animationType, causing parallax to fail on server-rendered blocks:

$has_animation = isset( $attrs['animationType'] ) && 'none' !== $attrs['animationType'];
$has_parallax = isset( $attrs['parallaxEnabled'] ) && true === $attrs['parallaxEnabled'];

if ( $has_animation || $has_parallax ) {
    // Enqueue styles and inject data attributes + CSS variables
    if ( $has_parallax ) {
        $parallax_strength = isset( $attrs['parallaxStrength'] ) ? absint( $attrs['parallaxStrength'] ) : 50;
        $data_attrs .= ' data-parallax="1" data-parallax-strength="' . esc_attr( $parallax_strength ) . '"';
        $inline_styles = '--parallax-strength: ' . esc_attr( $parallax_strength ) . 'px;';
    }
}

Code Formatting

Applied Prettier to align with project standards.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Open WordPress Playground Preview

Copilot AI self-assigned this Nov 21, 2025
Code review fixes:
- Added webpack.config.js to properly build src/index.js
- Updated my-scroll-block.php to support parallax attributes in render_block filter
- Applied Prettier formatting to all files
- Verified build, lint, and typecheck all pass

Co-authored-by: fellyph <330792+fellyph@users.noreply.github.com>
Copilot AI changed the title [WIP] Add parallax effect support to scroll animation block Fix build configuration and parallax PHP rendering Nov 21, 2025
Copilot AI requested a review from fellyph November 21, 2025 20:06
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