class Rsg::Generators::Webpacker::InstallGenerator

Public Instance Methods

add_webpacker() click to toggle source
# File lib/rsg/generators/webpacker/install_generator.rb, line 10
def add_webpacker
  append_gem("webpacker", version: "~> 5.0")
end
banner() click to toggle source
configure_js() click to toggle source
# File lib/rsg/generators/webpacker/install_generator.rb, line 18
def configure_js
  copy_file "application.js", "app/javascript/packs/application.js", force: true

  inject_into_file "app/views/layouts/application.html.erb",
    "  <%= javascript_pack_tag 'application' %>\n  ",
    before: /<\/body>/
end
configure_landing() click to toggle source
# File lib/rsg/generators/webpacker/install_generator.rb, line 33
  def configure_landing
    template "landing_controller.rb.erb", "app/controllers/landing_controller.rb"
    copy_file "landing_show.html.erb", "app/views/landing/show.html.erb"
    inject_into_file "config/routes.rb", <<-CODE, before: "end"

 root 'landing#show'
    CODE
  end
configure_sass() click to toggle source
# File lib/rsg/generators/webpacker/install_generator.rb, line 26
def configure_sass
  copy_file "application.sass", "app/javascript/stylesheets/application.sass"
  gsub_file "app/views/layouts/application.html.erb",
    "stylesheet_link_tag",
    "stylesheet_pack_tag"
end
install_webpacker() click to toggle source
# File lib/rsg/generators/webpacker/install_generator.rb, line 14
def install_webpacker
  rake("webpacker:install")
end
sanity_check() click to toggle source
# File lib/rsg/generators/webpacker/install_generator.rb, line 2
def sanity_check
  raise "Can't configure webpacker on API apps" if api_mode?
end