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.
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.
There are 3 hooks in bower, postinstall may solve your problem if for whatever reason you can not pre-built like @Sindre Sorhus points out.
In .bowerrc do:
{
"scripts": {
"preinstall": "<your command here>",
"postinstall": "<your command here>",
"preuninstall": "<your command here>"
}
}
source https://github.com/bower/bower/blob/master/HOOKS.md
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With