Skip to content

Get rid of coffee-rails#1475

Closed
k0kubun wants to merge 3 commits intoShopify:mainfrom
k0kubun:remove-coffee-rails
Closed

Get rid of coffee-rails#1475
k0kubun wants to merge 3 commits intoShopify:mainfrom
k0kubun:remove-coffee-rails

Conversation

@k0kubun
Copy link
Member

@k0kubun k0kubun commented Mar 19, 2026

Same approach as #1467 for sassc-rails: compiled all CoffeeScript files to plain JavaScript using the CoffeeScript 1.12.7 compiler (matching coffee-rails 5.0), then removed the coffee-rails dependency entirely.

This is needed because coffee-rails depends on coffee-script which depends on execjs, causing issues in ruby-bench
(ruby/ruby-bench#493).

  • Compiled 18 .coffee files to .js using coffee -bc (bare compile)
  • Preserved sprockets directives (require, require_tree, require_self)
  • Preserved ERB in task/notifications.js.erb for image_path helpers
  • Removed coffee-rails from gemspec and lib/shipit.rb
  • No changes needed to HTML templates or asset precompile configuration

Same approach as Shopify#1467 for sassc-rails: compiled all CoffeeScript files
to plain JavaScript using the CoffeeScript 1.12.7 compiler (matching
coffee-rails 5.0), then removed the coffee-rails dependency entirely.

This is needed because coffee-rails depends on coffee-script which
depends on execjs, causing issues in ruby-bench
(ruby/ruby-bench#493).

- Compiled 18 .coffee files to .js using `coffee -bc` (bare compile)
- Preserved sprockets directives (require, require_tree, require_self)
- Preserved ERB in task/notifications.js.erb for image_path helpers
- Removed coffee-rails from gemspec and lib/shipit.rb
- No changes needed to HTML templates or asset precompile configuration
k0kubun added 2 commits March 19, 2026 17:06
The ansi_stream gem ships ansi_stream.coffee in its vendor assets.
Sprockets 3.x has a built-in CoffeeScript processor that tries to
require 'coffee_script' when encountering .coffee files. Without
coffee-rails, this causes LoadError during asset precompilation.

Vendor a pre-compiled JS version of ansi_stream so it takes precedence
over the gem's .coffee file in the sprockets asset paths.
The ansi_stream gem is Copyright (c) 2014 Guillaume Malette, MIT licensed.
Include the full license text as required by the MIT license terms.
@k0kubun k0kubun marked this pull request as ready for review March 20, 2026 00:15
@k0kubun
Copy link
Member Author

k0kubun commented Mar 20, 2026

#1467
We may also want to consider doing something similar for coffee-rails

This PR does this. WDYT? @Edouard-chin @etiennebarrie @rafaelfranca cc: @byroot

@byroot
Copy link
Contributor

byroot commented Mar 20, 2026

WDYT?

If it's necessary, we can do it, but I think as others mentioned, ruby-bench can just not compile assets.

sassc was important because it was failing during boot, but here it's just a codepath we don't wanna call.

@k0kubun
Copy link
Member Author

k0kubun commented Mar 20, 2026

Thanks for your feedback. I guess ruby/ruby-bench#495 obviates this, so I'm gonna close this.

@k0kubun k0kubun closed this Mar 20, 2026
@k0kubun k0kubun deleted the remove-coffee-rails branch March 20, 2026 18:56
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