Class: Umlaut::AssetHooks
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Umlaut::AssetHooks
- Defined in:
- lib/generators/umlaut/asset_hooks_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_to_javascript_manifest ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/generators/umlaut/asset_hooks_generator.rb', line 28 def add_to_javascript_manifest unless IO.read("app/assets/javascripts/application.js").include?('Umlaut') prepend_to_file "app/assets/javascripts/application.js" do %q{ // Umlaut javascript required for proper functionality. The 'umlaut' file // also forces require of jquery and jquery-ui, dependencies. //= require 'umlaut' } end else say_status("skipped", "Your application.js already references Umlaut", :yellow) end end |
#add_to_stylesheet_manifest ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/umlaut/asset_hooks_generator.rb', line 6 def add_to_stylesheet_manifest existing = IO.read("app/assets/stylesheets/application.css") unless existing.include?('Umlaut') after = if existing.include?("require_self") "require_self" else "/*" end insert_into_file "app/assets/stylesheets/application.css", :after => after do %q{ * * The base Umlaut styles: *= require 'umlaut' *} end else say_status("skipped", "Your application.css already references Umlaut", :yellow) end end |