Class: Geoblacklight::AssetsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/geoblacklight/assets_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_initializersObject



38
39
40
41
42
43
44
# File 'lib/generators/geoblacklight/assets_generator.rb', line 38

def add_initializers
  append_to_file "config/initializers/assets.rb",
    "\nRails.application.config.assets.precompile += %w( favicon.ico )\n"

  append_to_file "config/initializers/assets.rb",
    "\nRails.application.config.assets.paths << Rails.root.join('vendor', 'assets', 'images')\n"
end

#add_javascriptObject



17
18
19
20
21
22
23
24
# File 'lib/generators/geoblacklight/assets_generator.rb', line 17

def add_javascript
  copy_file "assets/geoblacklight.js", "app/assets/javascripts/geoblacklight.js"

  if Rails.version.to_i >= 6
    append_to_file "app/assets/javascripts/application.js",
      "\n// Required by GeoBlacklight\n//= require geoblacklight"
  end
end

#add_stylesheetsObject



31
32
33
34
35
36
# File 'lib/generators/geoblacklight/assets_generator.rb', line 31

def add_stylesheets
  copy_file "assets/application.scss", "app/assets/stylesheets/application.scss"
  copy_file "assets/_blacklight.scss", "app/assets/stylesheets/_blacklight.scss"
  copy_file "assets/_customizations.scss", "app/assets/stylesheets/_customizations.scss"
  copy_file "assets/_geoblacklight.scss", "app/assets/stylesheets/_geoblacklight.scss"
end

#remove_stylesheetsObject



26
27
28
29
# File 'lib/generators/geoblacklight/assets_generator.rb', line 26

def remove_stylesheets
  remove_file "app/assets/stylesheets/application.css"
  remove_file "app/assets/stylesheets/blacklight.scss"
end