App/javascript feels like the wrong name for that directory

What I would propose is:

  • Put webpacker files in app/assets instead of app/javascript
  • Edit webpacker.yml and set the source_path to app/assets
  • Add necessary CSS imports in application.scss when generators add stylesheets when webpacker is loaded but sprockets is not.
  • Uncomment images related code in application.js

About the flag using rails new --skip-sprockets could trigger these changes.

1 Like

Perhaps not as cute, but we’ve used app/webpack_assets/ instead. Fairly non-controversial on its face, and honestly, if the immediate future supports both webpack and sprockets working in tandem, why muddy the waters not calling out the directory explicitly?

Or, I guess:

  • app/assets/webpack
  • app/assets/sprockets

To be collapsed back down to app/assets once we have only one option.

3 Likes

I see my fellow developers are changing default to app/frontend.

The problem I am getting in rails 6 is the autoload paths now should --except app/frontend too.

Autoloading and Reloading Constants — Ruby on Rails Guides

Then I have to config Zeitwerk to unload that folder unconventionally. Because in JS world kebab-case naming makes sense.