Class: Blacklight::Assets::PropshaftGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/blacklight/assets/propshaft_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_packageObject



6
7
8
9
10
11
12
# File 'lib/generators/blacklight/assets/propshaft_generator.rb', line 6

def add_package
  if ENV['CI']
    run "yarn add file:#{Blacklight::Engine.root}"
  else
    run "yarn add blacklight-frontend@#{Blacklight::VERSION}"
  end
end

#add_package_assetsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/blacklight/assets/propshaft_generator.rb', line 18

def add_package_assets
  append_to_file 'app/assets/stylesheets/application.bootstrap.scss' do
    <<~CONTENT
      @import "blacklight-frontend/app/assets/stylesheets/blacklight/blacklight";
    CONTENT
  end

  append_to_file 'app/javascript/application.js' do
    <<~CONTENT
      import Blacklight from "blacklight-frontend";
      import githubAutoCompleteElement from "@github/auto-complete-element";
    CONTENT
  end
end

#add_third_party_packagesObject



14
15
16
# File 'lib/generators/blacklight/assets/propshaft_generator.rb', line 14

def add_third_party_packages
  run 'yarn add @github/auto-complete-element'
end