Files
rspade_system/app/RSpade/Core/Bundle/CLAUDE.md
root f6fac6c4bc Fix bin/publish: copy docs.dist from project root
Fix bin/publish: use correct .env path for rspade_system
Fix bin/publish script: prevent grep exit code 1 from terminating script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 02:08:33 +00:00

1.6 KiB
Executable File

Bundle Processor System

Architecture

  • Extension-agnostic BundleCompiler: Only handles .js and .css files directly
  • Global processor configuration: Processors configured in config/rsx.php under bundle_processors
  • Processors receive ALL files: Each processor examines all collected files and decides what to process
  • No per-bundle processor config: Processors are globally enabled, not per-bundle

How It Works

  1. BundleCompiler collects ALL files from bundle includes (not just JS/CSS)
  2. Each configured processor receives the full list of collected files
  3. Processors decide which files to process based on extension or other criteria
  4. Processed files replace or augment original files in the bundle
  5. Final bundle contains JS and CSS files only

Creating a Processor

class MyProcessor extends AbstractBundleProcessor {
    public static function get_name(): string { return 'myprocessor'; }
    public static function get_extensions(): array { return ['myext']; }
    public static function process(string $file_path, array $options = []): ?array {
        // Transform file and return result or null to exclude
    }
}

Registering Processors

Add to config/rsx.php:

'bundle_processors' => [
    \App\RSpade\Processors\MyProcessor::class,
]

SCSS @import Validation

  • Non-vendor files: Cannot use @import directives (throws error)
  • Vendor files: Files in directories named 'vendor' CAN use @import
  • Rationale: @import bypasses bundle dependency management
  • Solution: Include dependencies directly in bundle definition