Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Rails with Webpack

Nathan Struhs edited this page May 19, 2019 · 1 revision

This Ruby on Rails project uses Webpack instead of the default Asset Pipeline for JavaScript pre-processing and static asset management. Notice the project does not have a app/assets directory and instead has app/javascripts.

Good resources to get started:

Components

Frontend components live in app/javascripts/components. Any section of the frontend that can be reused in multiple places or uses javascript is a good candidate to be made into a component.

render vs render_component

Throughout the frontend of the project you will see method calls of render and render_component. The difference is #render allows you to show Rails partials that are located in the app/views directory. #render_component is a method which allows you to show components found in app/javascripts/components.

Custom Rails generator

To add your own component you can use our custom rails generator found at lib/generators/component_generator.rb:

rails generate component <component-name>