BSD Ports

www/ruby-importmap-rails 2.2.3 NetBSD

Use ESM with importmap to manage modern JavaScript in Rails

System
NetBSD
Repository
pkgsrc
Maintainer
[email protected]
License
mit
Categories
www, ruby
Package size
45.7 KiB, 117.7 KiB installed

Description

# 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 whole bundle, now only the cache for that single file is invalidated.

[Import maps are supported natively in all major, modern browsers](https://caniuse.com/?search=importmap). If you need to work with legacy browsers without native support, you can explore using [the shim available](https://github.com/guybedford/es-module-shims).

Install

Binary package:

pkgin install ruby33-importmap-rails

From pkgsrc:

cd /usr/pkgsrc/www/ruby-importmap-rails && make install clean

Packages

The version each package repository carries. “-” means the repository builds no package of it, “n/a” that there is no such repository.

RepositoryVersion
NetBSD 10.1 x86_642.2.3
NetBSD 10.1 aarch642.2.3
SmartOS / illumos x86_642.2.3
macOS 15 arm642.2.3

Dependencies

Run dependencies 2
Required by 1

Configuration

No options to configure.

Service scripts
none
Flavors
ruby34-importmap-rails-2.2.3, ruby40-importmap-rails-2.2.3