Sha256: b2c9228cd3b2476531a18c1a1a9b507408bcb8449fb8d437fdb2067a4146c357
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
require_relative "../base" module Rsg module Webpacker class InstallGenerator < Generators::Base def self.source_root Pathname.new(__FILE__).dirname.join("templates").expand_path end def sanity_check raise "Can't configure webpacker on API apps yet" if api_mode? end def banner say("Configuring webpacker") end def add_webpacker append_gem("webpacker", version: "~> 5.0") end def install_webpacker rake("webpacker:install") end 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 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 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rsg-0.0.1 | lib/rsg/generators/webpacker/install_generator.rb |