Sha256: fb88daf62b1227a9cede299390e8f542f22bd751f302d0aaa456c823f6e83372

Contents?: true

Size: 1.07 KB

Versions: 21

Compression:

Stored size: 1.07 KB

Contents

require "webpacker/configuration"

say "Copying coffee loader to config/webpack/loaders"
copy_file "#{__dir__}/loaders/coffee.js", Rails.root.join("config/webpack/loaders/coffee.js").to_s

say "Adding coffee loader to config/webpack/environment.js"
insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
  "const coffee =  require('./loaders/coffee')\n",
  after: /require\(('|")@rails\/webpacker\1\);?\n/

insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
  "environment.loaders.prepend('coffee', coffee)\n",
  before: "module.exports"

say "Updating webpack paths to include .coffee file extension"
insert_into_file Webpacker.config.config_path, "- .coffee\n".indent(4), after: /\s+extensions:\n/

say "Copying the example entry file to #{Webpacker.config.source_entry_path}"
copy_file "#{__dir__}/examples/coffee/hello_coffee.coffee",
  "#{Webpacker.config.source_entry_path}/hello_coffee.coffee"

say "Installing all Coffeescript dependencies"
run "yarn add coffeescript@1.12.7 coffee-loader"

say "Webpacker now supports Coffeescript 🎉", :green

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/lib/install/coffee.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/lib/install/coffee.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/lib/install/coffee.rb
webpacker-5.4.4 lib/install/coffee.rb
webpacker-5.4.3 lib/install/coffee.rb
webpacker-5.4.2 lib/install/coffee.rb
webpacker-5.4.1 lib/install/coffee.rb
webpacker-5.4.0 lib/install/coffee.rb
webpacker-5.3.0 lib/install/coffee.rb
webpacker-5.2.2 lib/install/coffee.rb
webpacker-5.2.1 lib/install/coffee.rb
webpacker-4.3.0 lib/install/coffee.rb
webpacker-5.2.0 lib/install/coffee.rb
webpacker-5.1.1 lib/install/coffee.rb
webpacker-5.1.0 lib/install/coffee.rb
webpacker-5.0.1 lib/install/coffee.rb
webpacker-5.0.0 lib/install/coffee.rb
webpacker-4.2.2 lib/install/coffee.rb
webpacker-4.2.1 lib/install/coffee.rb
webpacker-4.2.0 lib/install/coffee.rb