gradle-grunt-plugin icon indicating copy to clipboard operation
gradle-grunt-plugin copied to clipboard

bowerInstall?

Open johnykov opened this issue 10 years ago • 6 comments

Hi, this an amazing plugin! I download node and does a lot for me! Thanks.

But for 100% of happiness I would need to fire "bower install" after npm install :) Do you have any example how to do that?

Thanks in advance

johnykov avatar Aug 29 '14 12:08 johnykov

Thanks for your kind words. That's a valid question. I have not any examples on this at hand, but will try it for myself and report back how it goes.

BR, Sten Roger

----- Original Message -----

From: "Jan" [email protected] To: "srs/gradle-grunt-plugin" [email protected] Sent: Friday, August 29, 2014 2:02:55 PM Subject: [gradle-grunt-plugin] bowerInstall? (#16)

Hi, this an amazing plugin! I download node and does a lot for me! Thanks.

But for 100% of happiness I would need to fire "bower install" after npm install :) Do you have any example how to do that?

Thanks in advance

— Reply to this email directly or view it on GitHub .

srs avatar Aug 29 '14 12:08 srs

I added this in my build.gradle

task bowerInstall(type:Exec){ commandLine './node_modules/bower/bin/bower', 'install' }

//process your bower.json after node deps install bowerInstall.dependsOn 'npmInstall'

and it works for now

johnykov avatar Aug 29 '14 14:08 johnykov

and of course I added bower to packages.json

johnykov avatar Aug 29 '14 14:08 johnykov

@hanskoff you may also want to check out the bower-install-simple grunt plugin for this: https://www.npmjs.org/package/grunt-bower-install-simple

Managing the bower stuff in your Gruntfile is arguably a better place since it minimizes the amount of stuff the gradle build needs to "know" about your grunt build and it works for devs who just run grunt too.

dougborg avatar Sep 26 '14 22:09 dougborg

@hanskoff another really simple solution is to add a postinstall script to your package.json.

  "scripts": {
    "postinstall": "bower install"
  }

Make sure you have bower set as a dev dependency in package.json. And note, this won't work if this project is used as a dependency for another.

dansomething avatar Oct 10 '14 20:10 dansomething

I used the solution that @dougborg proposes, installing the bower dependencies from withing grunt whith the bower-install-simple pluting.

Works perfect for me.

The only downside is how the configuration looks like, a little bit messed:

// run 'grunt bower_install'
grunt_bower_install.dependsOn 'installGrunt'
grunt_bower_install.dependsOn 'npmInstall'
grunt_default.dependsOn grunt_bower_install

// runs "grunt default" as part of your gradle build
build.dependsOn grunt_default

jmaister avatar Jan 07 '15 15:01 jmaister