Asset Pipeline has become popular thanks to Ruby on Rails which implements it nicely out of the box. In this post I will explain what an asset pipeline is, how you can easily implement it without using Ruby on Rails and why you should consider using it in building a webapp.
Don’t worry, closures is not a complex concept to learn if you break it down into small parts as I’m doing here. What I usually do to keep things in my mind for good is to sketch up a mind map. Yep, a mind map like this one above that has the central subject in the middle and several branches off it. Each branch is a small part of the central subject and this drawing you see is similar to how our brain store information, therefore, it’s a great way to study things.
After this small introduction to mind maps, let’s start with this interesting subject: closures.
First of all, what’s a closure?
Imagine the situation where you have a single-page app. You start playing around with it and after some actions you decide to click the back button from the browser to go back to a previous state.
Do you think your app is prepared for it?
Dealing with browser history can be a headache specially if your app rely on Ajax calls or you have a single page app. Users love using the back button and developers hate it.
The problem with the browser history in Single-Page applications is that the browser is not able to keep track of the states of your application, differently than the traditional multi-page app where every state is usually bound to a different URL.
So what can we do to let users use the back button and at the same time make sure your application won’t break?