Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Use grunt-bower-install for HTML dependency injection. #497

Closed
wants to merge 1 commit into from

Conversation

stephenplusplus
Copy link
Contributor

To sync up the generators, I added grunt-bower-install here. It definitely needs to be tested, and my computer is in a 💩-y state for that. So, I thought I'd see if anyone here had a chance.

It turns out this isn't only nice for users, who will be able to inject dependencies automatically, but it's also created for some easier generator authoring. Less JS ifs, and more "let grunt-bower-install wiredep handle it." I attached a spawnCommand('grunt', ['bower-install']) callback after the scaffold finishes installing the NPM and Bower dependencies. Not sure if that's a good idea, best practice wise, but it works!

@passy
Copy link
Member

passy commented Dec 9, 2013

❤️ it!

Tested it briefly and it worked flawlessly.
@eddiemonge Could you also give it a try and take a look at the code?

this.installDependencies({ skipInstall: this.options['skip-install'] });
this.installDependencies({
skipInstall: this.options['skip-install'],
callback: function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does callback get called if this.options['skip-install'] is false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I re-factored a bit.

@addyosmani
Copy link
Member

LGTM and testing works. Could we also get a few users trying this out before we land it?

@kevinwolfcr
Copy link

I've implemented this method on my ngbp generator and everything works fine. But, I can not see the information message when the user passes the flag --skip-install.

Le source: https://github.com/kevin-wolf/generator-ngbp/blob/master/app/index.js

Any thoughts?

@sindresorhus
Copy link
Member

👍

});

this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
this.pkg = require(__dirname, '../package.json');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.pkg = require('../package.json');

@kevinwolfcr
Copy link

Haha. My question was; did you know why the function isn't calling when the user adds the --skip-install flag?

@eddiemonge
Copy link
Member

i keep meaning to get to this and i should be able to today or tomorrow

@ghost ghost assigned eddiemonge Dec 11, 2013
@passy
Copy link
Member

passy commented Dec 12, 2013

@eddiemonge Awesome! :)

@eddiemonge
Copy link
Member

made a couple of small tweaks and landed it

stevemao pushed a commit to stevemao/generator-angular that referenced this pull request Nov 6, 2014
fix(gen): use bool for bootstrap filters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants