Class: Rsg::Generators::Webpacker::BootstrapGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/rsg/generators/webpacker/bootstrap_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_bootstrapObject



10
11
12
13
# File 'lib/rsg/generators/webpacker/bootstrap_generator.rb', line 10

def add_bootstrap
  return say("Bootstrap already installed, skipping") if File.read("yarn.lock") =~ /^bootstrap[^:]+:/
  run "yarn add bootstrap bootstrap-icons"
end

#application_sassObject



15
16
17
# File 'lib/rsg/generators/webpacker/bootstrap_generator.rb', line 15

def application_sass
  copy_file "bootstrap/application.sass", "app/javascript/stylesheets/application.sass"
end


6
7
8
# File 'lib/rsg/generators/webpacker/bootstrap_generator.rb', line 6

def banner
  say("Configuring Bootstrap")
end

#htmlsObject



19
20
21
22
23
24
25
26
# File 'lib/rsg/generators/webpacker/bootstrap_generator.rb', line 19

def htmls
  # TODO: These will ask to confirm for an overwrite, should we just force?
  template "bootstrap/layout.html.erb", "app/views/layouts/application.html.erb"
  template "bootstrap/landing.html.erb", "app/views/landing/show.html.erb"
  # template "bootstrap/about.html.erb", "app/views/landing/about.html.erb"
  # template "bootstrap/contact.html.erb", "app/views/landing/contact.html.erb"
  # template "bootstrap/login.html.erb", "app/views/landing/login.html.erb"
end

#sanity_checkObject



2
3
4
# File 'lib/rsg/generators/webpacker/bootstrap_generator.rb', line 2

def sanity_check
  raise "Can't configure bootstrap on API apps" if api_mode?
end