Sha256: 0862374710fc1f7e1680c7723b02cec93ef3341f7aa6104e11288aa771e3066a

Contents?: true

Size: 1014 Bytes

Versions: 18

Compression:

Stored size: 1014 Bytes

Contents

require "webpacker/configuration"

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

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

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

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

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

say "Installing all Erb dependencies"
run "yarn add rails-erb-loader"

say "Webpacker now supports Erb in JS 🎉", :green

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/webpacker-4.0.7/lib/install/erb.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/webpacker-4.0.7/lib/install/erb.rb
webpacker-4.0.7 lib/install/erb.rb
webpacker-4.0.6 lib/install/erb.rb
webpacker-4.0.5 lib/install/erb.rb
webpacker-4.0.4 lib/install/erb.rb
webpacker-4.0.3 lib/install/erb.rb
webpacker-4.0.2 lib/install/erb.rb
webpacker-4.0.1 lib/install/erb.rb
webpacker-4.0.0 lib/install/erb.rb
webpacker-4.0.0.rc.8 lib/install/erb.rb
webpacker-4.0.0.rc.7 lib/install/erb.rb
webpacker-4.0.0.rc.6 lib/install/erb.rb
webpacker-4.0.0.rc.5 lib/install/erb.rb
webpacker-4.0.0.rc.4 lib/install/erb.rb
webpacker-4.0.0.rc.3 lib/install/erb.rb
webpacker-4.0.0.rc.2 lib/install/erb.rb
webpacker-4.0.0.rc.1 lib/install/erb.rb