Mid-level Track Roadmap

Asset pipeline: Importmaps

This course explains how a Rails 8 app loads JavaScript with importmaps, without Node.js or a build step. It covers the pin API in config/importmap.rb, Propshaft as the asset server that fingerprints and serves files, and how Stimulus controllers are registered from file names. It also shows the bin/importmap workflow for adding vendored or CDN packages, and the production side: module preloading, long-lived caching, and Content Security Policy. The last lesson traces the full path from a pin to code running in the browser.

What you'll learn

  • ✓How the browser resolves modules through an importmap without a bundler
  • ✓Mapping modules to files with pin, pin_all_from, to: and under:
  • ✓How Propshaft serves assets, adds fingerprints and searches load paths
  • ✓How file paths become Stimulus controller identifiers and get registered
  • ✓Adding, updating, auditing and removing packages with bin/importmap
  • ✓Module preloading, asset caching and Content Security Policy in production
Free preview · Lesson 1 4 min read

What is an importmap: no bundler needed

Most JavaScript frameworks require a build step: a bundler like Webpack, esbuild, or Vite that transforms, concatenates, and minifies your JavaScript before the browser can use it. Rails 8 takes a different approach: importmaps. No Node.js. No node_modules. No build step for JavaScript at all.

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...