Sha256: 6fcf98e294566e35c405c1a596ee077d237034f44ea4d49500e532875c52dfd8

Contents?: true

Size: 1004 Bytes

Versions: 15

Compression:

Stored size: 1004 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.append('erb', erb)\n",
  before: "module.exports"

say "Updating webpack paths to include .erb file extension"
insert_into_file Webpacker.config.config_path, "    - .erb\n", after: /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

15 entries across 15 versions & 1 rubygems

Version Path
webpacker-3.6.0 lib/install/erb.rb
webpacker-3.5.5 lib/install/erb.rb
webpacker-3.5.3 lib/install/erb.rb
webpacker-3.5.2 lib/install/erb.rb
webpacker-3.5.1 lib/install/erb.rb
webpacker-3.5.0 lib/install/erb.rb
webpacker-3.4.3 lib/install/erb.rb
webpacker-4.0.0.pre.pre.2 lib/install/erb.rb
webpacker-4.0.0.pre.pre.1 lib/install/erb.rb
webpacker-3.4.1 lib/install/erb.rb
webpacker-3.4.0 lib/install/erb.rb
webpacker-3.3.1 lib/install/erb.rb
webpacker-3.3.0 lib/install/erb.rb
webpacker-3.2.2 lib/install/erb.rb
webpacker-3.2.1 lib/install/erb.rb