Sha256: 31fc564625e182436f6053f3be7986e7aa4791d1f353b7d65f5d4692e402439d

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

require 'rails/generators'

module Umlaut
  class AssetHooks < Rails::Generators::Base
    
    def add_to_stylesheet_manifest
      unless IO.read("app/assets/stylesheets/application.css").include?('Umlaut')
        insert_into_file "app/assets/stylesheets/application.css", :after => "/*" do
          %q{ 
 * The base Umlaut styles:
 *= require 'umlaut'         
          }
        end
        append_to_file("app/assets/stylesheets/application.css") do
          %q{
          
  /* Umlaut needs a jquery-ui theme CSS. Here's an easy way to get one,
     you can replace with another theme. */
  @import url(//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css);
          }
        end
      else
        say_status("skipped", "Your application.css already references Umlaut", :yellow)
      end
    end
    
    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
    
    
  end  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
umlaut-3.0.0alpha7 lib/generators/umlaut/asset_hooks_generator.rb