UNPKG

generator-baffled

Version:
30 lines (21 loc) 852 B
'use strict'; var path = require('path'); var util = require('util'); var yeoman = require('yeoman-generator'); module.exports = Generator; function Generator() { yeoman.generators.NamedBase.apply(this, arguments); this.sourceRoot(path.join(__dirname, '../templates')); if (typeof this.env.options.appPath === 'undefined') { try { this.env.options.appPath = require(path.join(process.cwd(), 'bower.json')).appPath; } catch (e) {} this.env.options.appPath = this.env.options.appPath || 'app'; } } util.inherits(Generator, yeoman.generators.NamedBase); Generator.prototype.createViewFiles = function createViewFiles() { var file = path.join(this.env.options.appPath, 'views'); this._.each(this.arguments, function(module) { file = path.join(file, module); }); this.template('common/view.html', file + '.html'); };