From 6a674db689320b6794952f1b3f79f5b083ba3454 Mon Sep 17 00:00:00 2001 From: Sam Power Date: Mon, 6 Jun 2022 12:52:08 -0400 Subject: [PATCH] Add installation instructions for importmap-rails --- guides/source/working_with_javascript_in_rails.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md index bcc86803c3..6549fddbaa 100644 --- a/guides/source/working_with_javascript_in_rails.md +++ b/guides/source/working_with_javascript_in_rails.md @@ -32,6 +32,20 @@ manage your JavaScript dependencies, there is no need to install Node.js or Yarn When using import maps, no separate build process is required, just start your server with `bin/rails server` and you are good to go. +### Installing importmap-rails + +Importmap for Rails is automatically included in Rails 7+ for new applications, but you can also install it manually in existing applications: + +```bash +$ bin/bundle add importmap-rails +``` + +Run the install task: + +```bash +$ bin/rails importmap:install +``` + ### Adding NPM Packages with importmap-rails To add new packages to your import map-powered application, run the `bin/importmap pin` command