Class: AdministrateBootstrapTheme::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#append_assetsObject



7
8
9
10
11
12
13
14
15
# File 'lib/generators/administrate_bootstrap_theme/install/install_generator.rb', line 7

def append_assets
  append_file 'config/initializers/assets.rb', <<~FILE
    Rails.application.config.assets.precompile += %w[
      administrate-bootstrap-theme.scss
      administrate-bootstrap-theme/theme.css
      administrate-bootstrap-theme/bootstrap.bundle.js
    ]
  FILE
end

#create_initializerObject



25
26
27
28
29
30
31
# File 'lib/generators/administrate_bootstrap_theme/install/install_generator.rb', line 25

def create_initializer
  initializer 'administrate_bootstrap_theme.rb', <<~FILE
    Administrate::Engine.stylesheets.clear # required to remove Administrate base styles
    Administrate::Engine.add_stylesheet('administrate-bootstrap-theme')
    Administrate::Engine.add_javascript('administrate-bootstrap-theme/bootstrap.bundle.js')
  FILE
end

#create_stylesheets_assetsObject



17
18
19
20
21
22
23
# File 'lib/generators/administrate_bootstrap_theme/install/install_generator.rb', line 17

def create_stylesheets_assets
  create_file 'app/assets/stylesheets/administrate-bootstrap-theme.scss', <<~FILE
    @import 'administrate-bootstrap-theme/colors/default';
    @import 'administrate-bootstrap-theme/fonts/source_sans_pro';
    @import 'administrate-bootstrap-theme/theme';
  FILE
end