To better understand what we are going to solve in this post take a look at what Pathmodify does.


Notice lines 8-11 which is where the pathmodify plugin is used. On lines 9-10 is where we will alias a directory. We will take line 10 as an example from here on. The method .dir in pathmodify.mod.dir() takes two arguments. The first is the name of the alias in this case it’s “ng_services”, and this can be anything you want. The second argument is the absolute system path where your in this case angular services reside.


Now, in our app.js file we can use these new alias within our require() methods.  Take a look at all the require methods and notice how the alias are used.  So, now instated of using something along the lines of ../../../../../ you can just use the alias.