angular-fullstack / generator-angular-fullstack

Yeoman generator for an Angular app with an Express server
https://awk34.gitbook.io/generator-angular-fullstack
6.12k stars 1.24k forks source link

Generated wrong path in index.html for controller script #7

Closed pgilad closed 11 years ago

pgilad commented 11 years ago

the controller was generated using yo angular-fullstack:controller Employee

and the path that was injected to index.html as the script src was: <script src="script\controllers\Employee.js"></script>

instead of: <script src="script/controllers/Employee.js"></script>

I suspect this is due to me being on Windows (8.1) and that path.join resulted in a path that is correct for the os, but wrong for script forward slash syntax.

Any thoughts?

I think the problem is here: (script-base.js)

Generator.prototype.generateSourceAndTest = function (appTemplate, testTemplate, targetDirectory, skipAdd) {
  this.appTemplate(appTemplate, path.join('scripts', targetDirectory, this.name));
  this.testTemplate(testTemplate, path.join(targetDirectory, this.name));
  if (!skipAdd) {
    this.addScriptToIndex(path.join(targetDirectory, this.name));
  }
};
DaftMonk commented 11 years ago

I'm closing this because this is almost certainly an issue with the generator-angular project, so I would suggest you submit the error to them, and once they fix the problem I'll pull their changes into my project.

This is one of the reasons I'm considering removing these directive/controller/service(etc..) sub generators from this project, which are direct copies of the generator-angular generators.

Running these generators through generator-angular, on a project generated with generator-angular-fullstack should do the exact the same. So by separating them out, it just makes the responsibility for problems like this less much confusing.

It does sound like you've found the cause of the problem though, so hopefully someone over there will get that straightened out :)