Class: Collavre::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/collavre/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#install_build_scriptObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/collavre/install/install_generator.rb', line 13

def install_build_script
  build_script = Rails.root.join("script/build.cjs")

  if options[:replace_build_script] || !File.exist?(build_script)
    template "build.cjs.tt", "script/build.cjs"
    say_status :create, "script/build.cjs (with Collavre support)", :green
  else
    update_existing_build_script(build_script)
  end
end

#show_post_installObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/generators/collavre/install/install_generator.rb', line 24

def show_post_install
  say ""
  say "Collavre assets installed!", :green
  say ""
  say "The build script now automatically finds Collavre gem and includes its assets."
  say ""
  say "Stylesheets are automatically available via Propshaft."
  say "Add to your application.css if needed:"
  say "  @import 'collavre/creatives';"
  say "  @import 'collavre/comments_popup';"
  say "  @import 'collavre/dark_mode';"
  say ""
  say "Run 'npm run build' to build assets."
  say ""
end