Class: F7::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_assetsObject



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

def add_assets
  js_manifest = 'app/assets/javascripts/application.js'
  
  if File.exist?(js_manifest)
    insert_into_file js_manifest, "//= require framework7\n", :before => "//= require jquery\n"
  else
    copy_file "application.js", js_manifest
  end
  
  css_manifest = 'app/assets/stylesheets/application.css'
  
  if File.exist?(css_manifest)
    insert_into_file css_manifest, " *= require framework7\n *= require framework7.themes\n", :before => " *= require_self"
  else
    copy_file "application.css", css_manifest
  end
end