Asset Paths Behavior (Rails 8, Propshaft, Esbuild)

Here’s a question about the behavior of the rails assets:precompile command.

When I add these two lines to my app/config/initializers/assets.rb file:

Rails.application.config.assets.paths << Rails.root.join('node_modules')
Rails.application.config.assets.paths << Rails.root.join('node_modules/bootstrap-icons/font')

I don’t see a specific folder added to public/assets/fonts as needed for my asset pipeline setup.

But when I only add one line to app/config/initializers/assets.rb

Rails.application.config.assets.paths << Rails.root.join('node_modules/bootstrap-icons/font')

I see the following added:

--public
  --assets
    --fonts
      -bootstrap-icons-7b0bd792.woff2
      -bootstrap-icons-61efca6d.woff

Why does the broader instruction of node_modules knock out the second instruction for font directory/file placement?

It’s a Propshaft that is doing it, and I’m the one who wrote it to do that. This is done to avoid having files appearing multiple times in the output folder and eating through limited storage space in Heroku slugs.

In your case, was adding node_modules just the example, or are you actually doing that? If so, what is the use case for needing the entire folder instead of only the folders you need?

It was an inherited config that I was using, but I’m trying to learn how to best utilize/setup the propshaft/esbuild system and noticed this behavior as I test things out

I agree with your reasoning, but wanted to know what to expect for propshaft behavior