Using Bower With Heroku

Published on Dec 29, 2016

2 min read


Originally Published at

Yes, I use Bower to maintain front-end dependencies, mostly for my side projects. Whatever you say, Bower is good and I am too anxious to mess with npm dependencies for front-end development. Plus, I feel that maintaining front-end dependencies with Bower helps in keeping my application’s skeleton clean.

So for last two of my projects, I have been using Heroku for deployment. Since I am maintaining front-end dependencies using Bower, I went through this article which is about generating buildpacks on Heroku. I find generating buildpacks adds unnecessary complexity in the process of application deployment, at least for rapid prototyping. Thus, I choose a different path. Adding Bower as an npm dependency seems an easy process and doesn’t add any kind of complexity. I find it’s great only if you are using Bower for rapid prototyping JavaScript applications.

After you are done with building your application, all you have to do is add Bower as an npm dependency in package.json file and then add a script under npm scripts to execute a command that will install bower dependencies before the application is deployed on Heroku.

Bower as dependency in package.json :

1"dependencies": {
2 "bower": "1.8.0"

And then add apostinstall command in npm scripts :

1"scripts": {
2 "postinstall": "./node\_modules/bower/bin/bower install"

You can read more about customizing Heroku Build Process here.

More Posts

Browse all posts

Aman Mittal author

I'm a software developer and a technical writer. On this blog, I write about my learnings in software development and technical writing.

Currently, working maintaining docs at 𝝠 Expo. Read more about me on the About page.

Copyright ©  2019-2024 Aman Mittal · All Rights Reserved.