How make bower build the package?

Guy Korland picture Guy Korland · Jun 18, 2013 · Viewed 17.3k times · Source

Is there a way to make bower run a package grunt after it was cloned from GitHub?

I'm trying to use Bower but one of the packages I'm using is the Bootstrap extension, x-editable. The problem is that while other packages push a fully built version to github so when installed by Bower you have a built version x-editable expect you to run a grunt file to build the package.

That is a common practice in other package managers like npm but I could find how to make Bower build it on install. Which means I need another mechanism to complete the installation of the package.

Answer

Sindre Sorhus picture Sindre Sorhus · Jun 18, 2013

Building on install is an anti-pattern and is strongly recommended against in Node. Like Node, Bower packages should be pre-built. This is because the end-user shouldn't have to care what preprocessor or build-system a package requires.

Your best options are to either convince the author to pre-build, fork and do it yourself, or build manually after you've installed the component.

The Bower team is planning to add the ability to publish packages to a server similar to how it works in npm. This will make it much better for packages needing a build-step.