instance method append_dependencies_to_package_file

Ruby on Rails 6.1.7.10

Since v6.1.7.10 Last seen in v6.1.7.10

Signature

append_dependencies_to_package_file()

No documentation comment.

Source
# File actiontext/lib/generators/action_text/install/install_generator.rb, line 19
      def append_dependencies_to_package_file
        if (app_javascript_pack_path = Pathname.new("app/javascript/packs/application.js")).exist?
          js_dependencies.each_key do |dependency|
            line = %[require("#{dependency}")]

            unless app_javascript_pack_path.read.include? line
              say "Adding #{dependency} to #{app_javascript_pack_path}", :green
              append_to_file app_javascript_pack_path, "\n#{line}"
            end
          end
        else
          say <<~WARNING, :red
            WARNING: Action Text can't locate your JavaScript bundle to add its package dependencies.

            Add these lines to any bundles:

            require("trix")
            require("@rails/actiontext")

            Alternatively, install and setup the webpacker gem then rerun `bin/rails action_text:install`
            to have these dependencies added automatically.
          WARNING
        end
      end

Defined in actiontext/lib/generators/action_text/install/install_generator.rb line 19 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionText::Generators::InstallGenerator

Type at least 2 characters to search.

↑↓ navigate · open · esc close