Sha256: 70278693c119264e1c96afdf9fb0f79f56a9a6b232cad932d7f7a74fc1f0cc54

Contents?: true

Size: 807 Bytes

Versions: 1

Compression:

Stored size: 807 Bytes

Contents

module ActiveadminAddons
  module Generators
    class WebpackerGenerator < Rails::Generators::Base
      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

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

        begin
          prepend_file(file_path, css_assets)
        end
      end

      def install_package
        run "yarn add activeadmin_addons@beta"
      end

      private

      def js_assets
        to_add = "import \"activeadmin_addons\"\n"
        to_add
      end

      def css_assets
        "@import 'activeadmin_addons/src/stylesheets/all';\n"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeadmin_addons-2.0.0.beta.0 lib/generators/activeadmin_addons/webpacker/webpacker_generator.rb