TheOdinProject / curriculum

The open curriculum for learning web development
https://www.theodinproject.com/
Other
9.08k stars 12.57k forks source link

Rails: Asset Pipeline Lesson #25588

Open crespire opened 1 year ago

crespire commented 1 year ago

Describe your suggestion

I wanted to start a conversation about re-writing the Rails Asset Pipeline lesson(s?), as there have been some big changes in the space and more on the way in the future with propshaft.

Right now, the asset pipeline lesson structure covers Rails 6 stuff first, then introduces Rails 7's import maps.

Here's my proposal on how we should change the lessons:

I spoke with @kobaltz about including his excellent "Demystifying the Asset Pipeline" Drifting Ruby episode and he has graciously agreed to allow us to link it as an additional resource. I feel strongly that, before we do that, we should update the content so it aligns more with what is currently prevalent/available.

Path

Ruby / Rails

Lesson Url

https://www.theodinproject.com/paths/full-stack-ruby-on-rails/courses/ruby-on-rails#assets-and-navigation

Checks

(Optional) Discord Name

crespire#8269

(Optional) Additional Comments

No response

KevinMulhern commented 1 year ago

Thanks for the detailed write up @crespire 💪

Totally agree theres a lot we can do a lot to improve this area. I'll have a think about this; and drop in some thoughts later next week.

But to start, and simplify things. We should drop any remaining Rails 6 related asset stuff. Learners don't need it in the context of our course so it just muddies the water.

crespire commented 1 year ago

Thanks for the detailed write up @crespire 💪

Totally agree theres a lot we can do a lot to improve this area. I'll have a think about this; and drop in some thoughts later next week.

But to start, and simplify things. We should drop any remaining Rails 6 related asset stuff. Learners don't need it in the context of our course so it just muddies the water.

I would love to at least keep some brief mention of Rails 6 and pre stuff in the context of "In the past, this is how it was done, so here's a quick run through in case you work on an app like this." Let me know your thoughts on that as well!

ChargrilledChook commented 1 year ago

@crespire I agree with @KevinMulhern , I would prefer to simplify and align with the official / recommended approaches.

I don't think it would hurt to mention previous tools, but I think teaching them in addition is going to confuse people more than help them. Given we specifically tell people to install Rails 7 we should focus our support there.

Happy to hear your thoughts if you feel strongly about it though

Otherwise sounds like a great idea 🚀

crespire commented 1 year ago

Okay, I will keep the old stuff to a minimal blurb to focus on the Rails 7 content, and if the blurb is too long, we can always shop it after a first draft!

KevinMulhern commented 1 year ago

Sorry for the delay and thanks again for getting this discussion going @crespire. After looking over it all, I think, perhaps, the biggest problem we have is everything is mixed together. It makes it really difficult to figure out the reason we have the different tools and by extension where the boundaries are between them.

To be fair, we didn't know where everything was going to land when updating the course for Rails 7. But now it's been out a while, we can optimize.

Whats the reason for all the different tools?

Mostly writing the following out for my own benefit to get things straight in my head lol.

What finally made it all click for me, was understanding the high level problems each tool is trying to solve:

The Asset Pipeline

Does three main things:

The problem with the asset pipeline, and why it’s being replaced with Propshaft and JS/CSS bundling is primarily because of the transpiling features of sprockets. The asset pipeline was constantly having to play catch up with all the new and popular frontend tooling constantly coming out.

So instead of the asset pipeline handling CSS/ JS tooling, it will now delegate to the new gems…

JS-Bundling

CSS bundling

Import Maps


How we could restructure

I think most of the content we have is still useable. With a bit of moving around to make the responsibilities and boundaries of the different tooling clearer and tightening up content we’ll be in much better shape.

This is how I think we could restructure things so they flow better:

Asset Pipeline Lesson

With that in place, we’ve introduced learners to assets in Rails and have a solid foundation we can then build upon with…

Section: Working with JS in Rails

It would include these lessons:

Stimulus JS

Import Maps

JS Bundling

Section: Turbo

CSS Bundling Lesson


Sorry @crespire, this got a lot longer than I intended. I know it's a lot to unpack and probably much bigger in scope than you might have been thinking.

If we were to even just restructure the lesson placement similar to the above; and make it clear within each lesson, the reason for that tools existence / problems it is trying to solve. It would go a long way towards making this stuff easier to grok imo. That would maybe be a good middle ground.

crespire commented 1 year ago

Lots of good stuff here! I'll have a think about some of the Qs you've raised, but I am happy to take on the project. I think it would be worthwhile not only for curriculum clarity, but also for my own learning to get a bit deeper with these things.

I'll have some responses and comments soon!

crespire commented 1 year ago

I've had a second read through, and while there is a big scope of work, I'm happy to proceed in a phased manner so we can make sure good changes can have an impact sooner.

How would we feel about the first step being a general "Here are all the tools" kind of re-write for the Asset Pipeline lesson?

I think most learners at this point are probably just using rails new so it's not completely critical or blocking if we do a high level review of the asset pipeline and its tooling without diving specifically into JS bundling/CSS bundling.

Then as a follow-on project, we can re-jig the other bits as you've suggested. I really like the revised structure here, just not sure we could do it all at once, unless we're willing to have it lag a little bit.

Let me know, I'd be happy to start on the first overview lesson re-write and maybe tweak some of the current stuff to flow better with the re-write once it's done.

KevinMulhern commented 1 year ago

Phased approach sounds great @crespire 💪 this should lend itself very well to being done over a few iterations.

How would we feel about the first step being a general "Here are all the tools" kind of re-write for the Asset Pipeline lesson?"

I think I have a good idea of what you're proposing for this. What are the high level things you think this should cover?

I think most learners at this point are probably just using rails new so it's not completely critical or blocking if we do a high level review of the asset pipeline and its tooling without diving specifically into JS bundling/CSS bundling.

This is exactly my line of thinking too. If students can't use it in the next available project, it's not worth the student spending time learning it right now. It won't be useful nor retained if it can't be put into practice at the next available opportunity.

We can sometimes fall into the trap of trying to cover everything in a lesson and almost recreating documentation. Our best lessons cover only whats needed, respecting the learners time and ultimately providing a much better experience for the end user.

crespire commented 1 year ago

What are the high level things you think this should cover?

I think the outline you provided about the high level problems Asset Pipeline is trying to solve and how modern Rails does it with delegation to new gems is the way to go.

I'm not exactly sure how it will shake out, but happy to draft something up for review/workshoping. I just know as a learner that these lessons were very heavy and I felt like they were missing a lot of the big picture which meant the specific content lacked a lot of context.

KevinMulhern commented 1 year ago

leading with the high level problems it solves sounds great to me @crespire 💪 giving learners an understanding of "why this thing exists" will add a ton of context we didn't have before.

I'd be tempted to skip talking about the new gems in this lesson, just because it's early in the course and students won't need JS or external CSS tools for their first few projects. But, also more than happy to see what you put together if you feel including them will make this better.

The only thing I'd add is to have a practical outcome in mind with the revised lesson. "What will the student be able to do by the end of the lesson?" kind of thing. Part of what makes these lessons so heavy is theres a lot of reading and little doing imo.

For this, being able to add vanilla CSS and work with images with a new Rails app seems like the most appropriate outcome. They'll be able to put those skills into practice in the early projects in the forms and authentication section.

github-actions[bot] commented 11 months ago

This issue is stale because it has had no activity for the last 30 days.

github-actions[bot] commented 10 months ago

This issue is stale because it has had no activity for the last 30 days.