Sha256: d15206037721b28175ed9917f676961568c1bcb24637d99b17e0ffaabfdc85fd

Contents?: true

Size: 755 Bytes

Versions: 2

Compression:

Stored size: 755 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'

        prepend_file(file_path, css_assets)
      end

      def install_package
        run "yarn add activeadmin_addons@beta"
      end

      private

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

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