class BaseCss::Generators::InstallGenerator

Public Instance Methods

add_assets() click to toggle source
# File lib/generators/base_css/install_generator.rb, line 8
def add_assets
  insert_into_file "app/assets/javascripts/application#{detect_js_format[0]}", "#{detect_js_format[1]} require shiv\n", :after => "jquery_ujs\n"
  insert_into_file "app/assets/javascripts/application#{detect_js_format[0]}", "#{detect_js_format[1]} require base-script\n", :after => "jquery_ujs\n"
  insert_into_file "app/assets/stylesheets/application#{detect_css_format[0]}", "#{detect_css_format[1]} require base-style\n", :after => "require_self\n"
end
detect_css_format() click to toggle source
# File lib/generators/base_css/install_generator.rb, line 19
def detect_css_format
  return ['.css', ' *='] if File.exist?('app/assets/stylesheets/application.css')
  return ['.css.sass', ' //='] if File.exist?('app/assets/stylesheets/application.css.sass')
  return ['.sass', ' //='] if File.exist?('app/assets/stylesheets/application.sass')
  return ['.css.scss', ' //='] if File.exist?('app/assets/stylesheets/application.css.scss')
  return ['.scss', ' //='] if File.exist?('app/assets/stylesheets/application.scss')
end
detect_js_format() click to toggle source
# File lib/generators/base_css/install_generator.rb, line 14
def detect_js_format
  return ['.js.coffee', '#='] if File.exist?('app/assets/javascripts/application.js.coffee')
  return ['.js', '//='] if File.exist?('app/assets/javascripts/application.js')
end