generator-angular icon indicating copy to clipboard operation
generator-angular copied to clipboard

Use AST for splicing generated code in.

Open dnozay opened this issue 9 years ago • 1 comments

I was looking into how to add support for the 3rd party ui-router lib... so I started reading the code. It seems we are using regular expressions and doing things on the cheap side. E.g. in utils.rewrite, if the needle isn't found, then the code is spliced at the beginning of the file, rather than adding the necessary constructs.

If I am adding a route, then if the .config section is missing, it should create one, maybe add a default route, and splice the new route in. This may be flaky with regexes, and maybe using AST (esprima?) would help in that situation.

dnozay avatar Nov 16 '14 20:11 dnozay

it would but how should we deal with {coffee/type}script support?

eddiemonge avatar Feb 02 '15 20:02 eddiemonge