Skip to content

Commit

Permalink
feat(gen): add hasFilter function
Browse files Browse the repository at this point in the history
Changes:
- add hasFilter(filter) to generator base, for easier conditionals in templates
  • Loading branch information
kingcody committed Sep 22, 2014
1 parent 36a509a commit fa39978
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion script-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ var Generator = module.exports = function Generator() {
this.cameledName = this._.camelize(this.name);
this.classedName = this._.classify(this.name);

this.hasFilter = function(filter) {
return this.config.get('filters').indexOf(filter) !== -1;
}.bind(this);

if (typeof this.env.options.appPath === 'undefined') {
try {
this.env.options.appPath = require(path.join(process.cwd(), 'bower.json')).appPath;
Expand All @@ -28,4 +32,4 @@ var Generator = module.exports = function Generator() {
this.sourceRoot(path.join(__dirname, '/templates'));
};

util.inherits(Generator, yeoman.generators.NamedBase);
util.inherits(Generator, yeoman.generators.NamedBase);

0 comments on commit fa39978

Please sign in to comment.