You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At MaMpf, we are currently migrating away from webpacker to Vite Ruby. During development, I often find myself opening all files for a specific page of our web app, say a user administration page. That is, I open the respective .js.erb for some controller actions, the controller .rb itself, maybe a .js that gets loaded on the first page load and a stylesheet .scss. These usually reside in very different folders. Of course, with modern IDEs, it's not too much of a hazzle to find your way around, but still, it feels like a pain point to me.
So, I was wondering what advantages/disadvantages a setup has, where I structure the app/frontend folder page- or component-wise? E.g. something like app/frontend/admin/users/ for the user administration page. Or app/frontend/login for login-related stuff. Or app/frontend/quizz for quiz-related stuff etc. And then put all resources related to it inside the respective folder, including the Rails views, JavaScript and CSS as well (except for the .rb controller itself, I'm fine with leaving that in a separate app/controllers folder).
Would this be a sensible approach or do I miss something entirely? The argument in the Rails community is often "Convention over Configuration" and that with common defaults, people can quickly start to work in new codebases. But I feel like having a component-/page-wise separation just eases onboarding and development as everything I need for working on a page is aggregated in a single folder, not spread over a plethora of different folders.
Is this an approach that I could get to work with Rails and Vite Ruby? If yes, I'd be very grateful if you could roughly outline the necessary changes I'd have to make to my config files or maybe just link to relevant config options. Would such an approach heavily impact the performance of Vite?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
At MaMpf, we are currently migrating away from webpacker to Vite Ruby. During development, I often find myself opening all files for a specific page of our web app, say a user administration page. That is, I open the respective
.js.erb
for some controller actions, the controller.rb
itself, maybe a.js
that gets loaded on the first page load and a stylesheet.scss
. These usually reside in very different folders. Of course, with modern IDEs, it's not too much of a hazzle to find your way around, but still, it feels like a pain point to me.So, I was wondering what advantages/disadvantages a setup has, where I structure the
app/frontend
folder page- or component-wise? E.g. something likeapp/frontend/admin/users/
for the user administration page. Orapp/frontend/login
for login-related stuff. Orapp/frontend/quizz
for quiz-related stuff etc. And then put all resources related to it inside the respective folder, including the Rails views, JavaScript and CSS as well (except for the.rb
controller itself, I'm fine with leaving that in a separateapp/controllers
folder).Beta Was this translation helpful? Give feedback.
All reactions