README.md in importmap-rails-1.0.3 vs README.md in importmap-rails-1.1.0

- old
+ new

@@ -1,21 +1,20 @@ # Importmap for Rails [Import maps](https://github.com/WICG/import-maps) let you import JavaScript modules using logical names that map to versioned/digested files – directly from the browser. So you can [build modern JavaScript applications using JavaScript libraries made for ES modules (ESM) without the need for transpiling or bundling](https://world.hey.com/dhh/modern-web-apps-without-javascript-bundling-or-transpiling-a20f2755). This frees you from needing Webpack, Yarn, npm, or any other part of the JavaScript toolchain. All you need is the asset pipeline that's already included in Rails. -With this approach you'll ship many small JavaScript files instead of one big JavaScript file. Thanks to HTTP/2 that no longer carries a material performance penalty during the initial transport, and in fact offers substantial benefits over the long run due to better caching dynamics. Whereas before any change to any JavaScript file included in your big bundle would invalidate the cache for the the whole bundle, now only the cache for that single file is invalidated. +With this approach you'll ship many small JavaScript files instead of one big JavaScript file. Thanks to HTTP/2 that no longer carries a material performance penalty during the initial transport, and in fact offers substantial benefits over the long run due to better caching dynamics. Whereas before any change to any JavaScript file included in your big bundle would invalidate the cache for the whole bundle, now only the cache for that single file is invalidated. There's [native support for import maps in Chrome/Edge 89+](https://caniuse.com/?search=importmap), and [a shim available](https://github.com/guybedford/es-module-shims) for any browser with basic ESM support. So your app will be able to work with all the evergreen browsers. ## Installation Importmap for Rails is automatically included in Rails 7+ for new applications, but you can also install it manually in existing applications: -1. Add `importmap-rails` to your Gemfile with `gem 'importmap-rails'` -2. Run `./bin/bundle install` -3. Run `./bin/rails importmap:install` +1. Run `./bin/bundle add importmap-rails` +2. Run `./bin/rails importmap:install` Note: In order to use JavaScript from Rails frameworks like Action Cable, Action Text, and Active Storage, you must be running Rails 7.0+. This was the first version that shipped with ESM compatible builds of these libraries. ## How do importmaps work? @@ -249,10 +248,10 @@ <% content_for :head do %> <%= javascript_import_module_tag "checkout" %> <% end %> ``` -**Important**: The `javacript_import_module_tag` should come after your `javascript_importmap_tags` +**Important**: The `javascript_import_module_tag` should come after your `javascript_importmap_tags` ```erb <%= javascript_importmap_tags %> <%= yield(:head) %> ```