Ruby on Rails

Modern Asset Pipeline & Frontend

Importmap-rails (Rails 7+), jsbundling/cssbundling, Hotwire (Turbo + Stimulus), Sprockets (legacy)

18 면접 질문·
Mid-Level
1

What is the default asset management system in Rails 7+?

답변

Importmap-rails is the default system in Rails 7+ for managing JavaScript files. It allows using native ES modules directly in the browser without a bundling step, by mapping package names to CDN URLs or local files. This significantly simplifies frontend configuration while eliminating the Node.js dependency.

2

How to add an external JavaScript library with Importmap-rails?

답변

The bin/importmap pin command adds a JavaScript library to the config/importmap.rb file. This command automatically resolves the package from jspm.io or a CDN and adds the corresponding mapping. For example, bin/importmap pin lodash adds the pin line for lodash pointing to the CDN.

3

Which Rails helper to use for including JavaScript scripts defined in the importmap?

답변

The javascript_importmap_tags helper generates the necessary tags to load the importmap and JavaScript entry point. It produces a script tag type='importmap' containing the mappings, as well as a tag to load the application.js file. This helper replaces javascript_pack_tag used with Webpacker.

4

What is the main difference between jsbundling-rails and cssbundling-rails?

5

What is the main role of Turbo Drive in Hotwire?

+15 면접 질문

다음 면접을 위해 Ruby on Rails을 마스터하세요

모든 질문, flashcards, 기술 테스트, 코드 리뷰 연습, 면접 시뮬레이터에 접근하세요.

무료로 시작하기