generator-ngfs
Version:
Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node
40 lines (33 loc) • 1.03 kB
JavaScript
var path = require('path');
var util = require('util');
var ScriptBase = require('../script-base.js');
var angularUtils = require('../util.js');
var Generator = module.exports = function Generator() {
ScriptBase.apply(this, arguments);
this.hookFor('angular-fullstack:controller');
this.hookFor('angular-fullstack:view');
};
util.inherits(Generator, ScriptBase);
Generator.prototype.rewriteAppJs = function () {
var coffee = this.env.options.coffee;
var config = {
file: path.join(
this.env.options.appPath,
'scripts/app.' + (coffee ? 'coffee' : 'js')
),
needle: '.otherwise',
splicable: [
" templateUrl: 'partials/" + this.name.toLowerCase() + "'" + (coffee ? "" : "," ),
" controller: '" + this.classedName + "Ctrl'"
]
};
if (coffee) {
config.splicable.unshift(".when '/" + this.name + "',");
}
else {
config.splicable.unshift(".when('/" + this.name + "', {");
config.splicable.push("})");
}
angularUtils.rewriteFile(config);
};
;