Class: Bootstrap::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Bootstrap::Generators::InstallGenerator
- Defined in:
- lib/generators/bootstrap/install/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#copy_assets ⇒ Object
10 11 12 13 14 15 |
# File 'lib/generators/bootstrap/install/install_generator.rb', line 10 def copy_assets copy_file "bootstrap.coffee", "app/assets/javascripts/bootstrap.js.coffee" ext = Rails.application.config.generators.[:rails][:stylesheet_engine] || :sass copy_file "bootstrap.css.#{ext}", "app/assets/stylesheets/bootstrap.css.#{ext}" end |
#load_css ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/generators/bootstrap/install/install_generator.rb', line 27 def load_css if File.exist?("app/assets/stylesheets/application.css") unless file_matches "app/assets/stylesheets/application.css", %r{\*= require_tree .[^/]} insert_into_file "app/assets/stylesheets/application.css", " *= require bootstrap\n", :before => "*/" end else puts "app/assets/stylesheets/application.css not found. Please add '= require twitter-bootstrap' manually." end end |
#load_js ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/generators/bootstrap/install/install_generator.rb', line 17 def load_js if File.exist?("app/assets/javascripts/application.js") unless file_matches "app/assets/javascripts/application.js", /= require_tree .[^\/]/ append_to_file "app/assets/javascripts/application.js", "//= require bootstrap\n" end else puts "Missing application.js/css. Please add '= require twitter-bootstrap' to your asset pipeline." end end |