srs / gradle-grunt-plugin

Gradle plugin for running Grunt tasks
106 stars 16 forks source link

bowerInstall? #16

Open johnykov opened 10 years ago

johnykov commented 10 years ago

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

srs commented 10 years ago

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" notifications@github.com To: "srs/gradle-grunt-plugin" gradle-grunt-plugin@noreply.github.com 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 .

johnykov commented 10 years ago

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 commented 10 years ago

and of course I added bower to packages.json

dougborg commented 10 years ago

@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.

dansomething commented 10 years ago

@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.

jmaister commented 9 years ago

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