Class: ActiveadminAddons::Generators::WebpackerGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/activeadmin_addons/webpacker/webpacker_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_javascriptsObject



4
5
6
7
8
9
# File 'lib/generators/activeadmin_addons/webpacker/webpacker_generator.rb', line 4

def add_javascripts
  file_path = 'app/javascript/packs/active_admin.js'
  reference = "import \"@activeadmin/activeadmin\";\n"

  inject_into_file(file_path, js_assets, after: reference)
end

#add_stylesheetsObject



11
12
13
14
15
16
17
# File 'lib/generators/activeadmin_addons/webpacker/webpacker_generator.rb', line 11

def add_stylesheets
  file_path = 'app/javascript/stylesheets/active_admin.scss'

  begin
    prepend_file(file_path, css_assets)
  end
end

#install_packageObject



19
20
21
# File 'lib/generators/activeadmin_addons/webpacker/webpacker_generator.rb', line 19

def install_package
  run "yarn add activeadmin_addons"
end