Class: Bootstrapped::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_assetsObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/generators/bootstrapped/install/install_generator.rb', line 10

def add_assets

  if File.exist?('app/assets/javascripts/application.js')
    insert_into_file "app/assets/javascripts/application.js", "//= require bootstrapped\n", :after => "jquery_ujs\n"
  else
    copy_file "application.js", "app/assets/javascripts/application.js"
  end

  if File.exist?('app/assets/stylesheets/application.css')
    # Add our own require:
    content = File.read("app/assets/stylesheets/application.css")
    style_require_block = " *= require bootstrapped\n"
    insert_into_file "app/assets/stylesheets/application.css", style_require_block, :after => "require_self\n"
  else
    copy_file "application.css", "app/assets/stylesheets/application.css"
  end

end