Class: Layered::Ui::Generators::CopyAssetsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/layered/ui/copy_assets_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



7
8
9
# File 'lib/generators/layered/ui/copy_assets_generator.rb', line 7

def self.source_root
  Layered::Ui::Engine.root
end

Instance Method Details

#copy_cssObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/generators/layered/ui/copy_assets_generator.rb', line 11

def copy_css
  source_path = File.join(self.class.source_root, "app/assets/tailwind/layered/ui/styles.css")
  source_content = File.read(source_path)

  header = <<~CSS
    /*
     * layered-ui-rails v#{Layered::Ui::VERSION}
     *
     * This file was automatically generated by the layered:ui:install generator.
     * Do not modify directly. To update, re-run: bin/rails generate layered:ui:install
     */

  CSS

  create_file "app/assets/tailwind/layered_ui.css", header + source_content
end