cgross / generator-cg-angular

Yeoman generator for Enterprise Angular projects.
MIT License
592 stars 198 forks source link

Coffee options? #4

Open DavidSouther opened 11 years ago

DavidSouther commented 11 years ago

Would you be interested in a pull request that added Coffeescript templates, and install generator options to choose them?

cgross commented 11 years ago

Yes absolutely. I would probably prefer a prompt when creating the project and then all code generated would be either js or coffee going forward. I would expect if someone wants to use coffee script then they would want everything in coffee script.

DavidSouther commented 11 years ago

That jives with what I was thinking. Give me a day or two - I'm refactoring a library, then I'll be taking a stab at this. I was very excited when I came across your generator agreeing with how I lay out Angular projects!


David Souther http://davidsouther.com

On Sun, Aug 18, 2013 at 10:41 AM, Chris Gross notifications@github.comwrote:

Yes absolutely. I would probably prefer a prompt when creating the project and then all code generated would be either js or coffee going forward. I would expect if someone wants to use coffee script then they would want everything in coffee script.

— Reply to this email directly or view it on GitHubhttps://github.com/cgross/generator-cg-angular/issues/4#issuecomment-22831540 .

sja commented 10 years ago

@DavidSouther Any progress for CoffeeScript support?

hxw commented 10 years ago

I started my own CoffeeScript version at https://github.com/hxw/generator-hxw-angular

so far only the initial app generation and partial are working. I am attempting to make each generation produce a working sample, so currently the partial generates a CoffeeScript-Class based controller complete with view and two tests.

The Gruntfile.coffee still need a lot of work and the other items need examples; it is just a work in progress and is probably rather buggy.

Alexandre-Herve commented 9 years ago

Hi @hxw , do you think your coffee script version is evolved enough to be used for an entreprise project ? Thanks a lot

hxw commented 9 years ago

Hello @Alexandre-Herve I have been using it to generate items for a simple project, but it seems that the class based construction I used has problems. Specifically CoffeScript appeas to make a copy of parent constructor fo the inherited bas class (done by compiler) so you appear to loose some of the dynamic nature of JS - new methods added to the parent cannot be accessed. this was discovered by a collegue who has tried my generator. So it was only used to "get started" with CoffeeScript; currently none of the partials in that code use the class approach - it looks vey similar to the JS approach just written in Coffeescript, so we get to clean up some of the syntax, remove extraneous {} and (). I think some of the later partials wer just cloned from previous ones rather than use the generator. On the other hand I have a small program that I am attempting to keep in the class based form using my generator, ok so far, I'll just see how it goes. it uses node webkit and I do use the auto reloder, though I found some things fail to reload (not sure if this is an effect the copied constructor problem) and ususally have to kill and restart grunt to make sure all changes get reload. I only have limited JS experience, I normally write in compiled languages and prefer non-C syntax, fo my small app using node webkit + angular, I just started using CoffeeScript direcly - I want to avoid JS if possible; except in 3rd party libs via bower. So after all that rambling, iguess the answer would be no to "enterprise ready"; I would sucggest that you could use something similar, but you may want to change the templates so that your partials/factories/tests contain the basic structure as required by your project so you can generate the skeletons to match you coding standards. My generator really need to be able to generate a non-class partial to be of use to more sophisticated use.