xiaohongshu
xiaohongshu
compare-erb-js
Compare ERB and JavaScript template outputs for the offline scoring SPA. Use when working on ERB-to-JS conversion, debugging template parity issues, or verifying that changes to scoring views work correctly in both ERB and SPA modes.
Full skill instructions
Use scripts/render_erb_and_js.rb to verify that ERB templates and their JavaScript-converted equivalents produce matching output. This is essential for the offline scoring SPA which uses auto-converted ERB templates.
# Compare heat list
bundle exec ruby scripts/render_erb_and_js.rb db/2025-barcelona-november.sqlite3 83
# Compare individual heat
bundle exec ruby scripts/render_erb_and_js.rb db/2025-barcelona-november.sqlite3 83 1
# With style parameter
bundle exec ruby scripts/render_erb_and_js.rb db/2025-barcelona-november.sqlite3 83 1 radio
Or using environment variable:
RAILS_APP_DB=2025-barcelona-november bundle exec ruby scripts/render_erb_and_js.rb 83 1
<main> content)/templates/scoring.js/scores/:judge/heats/dataheat_hydrator.js (for individual heats)All files are saved to /tmp/ for analysis:
/tmp/erb_rendered.html - ERB template output (main content only)/tmp/js_rendered.html - JavaScript template output/tmp/scoring_templates.js - Converted templates from /templates/scoring.js/tmp/heats_data.json - Raw normalized data from server/tmp/js_template_data.json - Hydrated data passed to JS template# Quick diff
diff /tmp/erb_rendered.html /tmp/js_rendered.html
# Side-by-side comparison
diff -y /tmp/erb_rendered.html /tmp/js_rendered.html | less
# Compare specific attributes
diff <(grep -o 'href="[^"]*"' /tmp/erb_rendered.html | sort) \
<(grep -o 'href="[^"]*"' /tmp/js_rendered.html | sort)
Some differences are expected due to ERB-to-JS conversion limitations:
" while JS uses "link_to may render differentlyThis tool supports the "Server computes, hydration joins, templates filter" principle:
heat_hydrator.js joins normalized data by resolving IDsapp/controllers/scores_controller.rb
heats_data action: Returns normalized JSON data for SPAheat action: Sets instance variables for ERB templatespaths: hash with server-computed URLsapp/controllers/templates_controller.rb
scoring action: Converts ERB templates to JavaScript on-the-flyErbPrismConverter for conversionlib/erb_prism_converter.rb
app/javascript/lib/heat_hydrator.js
buildLookupTables(): Creates Maps for O(1) entity lookuphydrateHeat(): Resolves IDs to full objectsbuildHeatTemplateData(): Prepares complete data for templatesapp/javascript/controllers/heat_app_controller.js
app/views/scores/heat.html.erb - Main heat viewapp/views/scores/heatlist.html.erb - Heat list viewapp/views/scores/_heat_header.html.erb - Heat header partialapp/views/scores/_info_box.html.erb - Info box with feedback errorsapp/views/scores/_navigation_footer.html.erb - Prev/next navigationapp/views/scores/_table_heat.html.erb - Standard heat tableapp/views/scores/_rank_heat.html.erb - Finals ranking viewapp/views/scores/_solo_heat.html.erb - Solo heat viewapp/views/scores/_cards_heat.html.erb - Card-based scoring viewscripts/render_erb_and_js.rb - This comparison toolscripts/hydrate_heats.mjs - Node.js script for hydrating data (used by comparison tool)xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience