Starting from a blank piece of paper or an empty notepad can be a daunting task. Where do I start? How do I get to the productive place? Most of the help that I find on the Internet start with, “Run these 15 npm install commands and then copy this code into these files.” Sure, doing that gets you to someone’s productive place, but rarely does it get me to my productive place. Also, you are now bound to that person’s setup for all future projects. I don’t like that especially as the web is a fluid landscape and changes all the time.
Bower has the advantage over classical NPM in that it produces a flat tree of dependencies. NPM would nest the dependencies and create quite the tree. NPM 3 though creates as flat a tree as it can. When coding we are taught to “Don’t Repeat Yourself” or DRY. Well if we aren’t supposed to repeat ourselves in code, why would we do it in the tools we end up using. The real crazy part of all of this is that we use NPM to install Bower. NPM can be used to install all of the frameworks that I use so why not just use it instead of Bower?
This started in my mind because there was a Tweet that I can’t find right now stating that Bower is dead and we should all use NPM. That’s great news. It’s one less tool that I have to keep sharp in my tool belt. Turns out that the Bower group is alive and kicking and looking for more volunteers.
Where was I going with all of this? Right, I don’t want to use Bower anymore. Don’t get me wrong here. Bower is great. You can specify a .bowerrc file and in it tell Bower where to put the libraries you download so they are immediately available. Like in the /wwwroot/libs folder. NPM always puts its downloads in the node_modules directory. This requires an extra step in Gulp to get the libraries moved into the specified folder.