Using Bower With Heroku

Published on Dec 29, 2016

2 min read

TOOLS

Originally Published at Hackernoon.com

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"
3}

And then add apostinstall command in npm scripts :

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

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. In this blog, I write about Technical writing, Node.js, React Native and Expo.

Currently, working at Expo. Previously, I've worked as a Developer Advocate, and Senior Content Developer with companies like Draftbit, Vercel and Crowdbotics.


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