-
Notifications
You must be signed in to change notification settings - Fork 620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(plugin): support for ng-annotate, process .ng.js files #244
Conversation
@netanelgilad :) I think that's great and it is also optional so why not? |
@Urigo I'm not sure I understand - I don't think people should be using gulp/grunt at all themselves. Meteor/angular-meteor should care of this in its plugin system, just like it's currently already watching/compiling/minifying files. As for an option to make it general...perhaps using a config json file? Like |
@nickjanssen yes that's true, so what if there is a default (with ng-annotate) and then only the programmers that will want to change that (for any reason and I think there might be a few as we can see the great usage and popularity of gulp and grunt) would be able to change that behaviour and use gulp? |
Again, I don't think people should be using gulp/grunt here. That's Meteor's job. Gulp/Grunt are tools that compile an entire app by concatenation, minification, copying files to a dist folder, watching and serving them, which is exactly what Meteor already does for us. So, we should help Meteor so it is smart enough to handle those As for letting people choose their |
@nickjanssen ok, great job! |
feat(plugin): support for ng-annotate, process .ng.js files
@nickjanssen what's your Twitter handle (for the new version announcement)? |
Guys, I'm trying to integrate Babel into my workflow, but running into some trouble. So, what I'm after is: file.es6 --> babel --> file.js --> ng-annotate --> file.js The annotate portion is why I'm asking in this thread. Maybe I should open a new thread? So, what I did is:
I have temporarily fixed this by copying grigio:babel and adding an ng-annotate step to it, immediatelu after the babel transpilation, which works very nicely indeed, for the moment. But, I would like to come up with a better solution, if at all possible. Any suggestions? |
The problem is with the current implementation of the plugin system that meteor uses. Every file extension can only have one plugin handling it. |
@netanelgilad Yes, that's also what I read about the current Meteor plugin design. Do you know if it is possible to define the order in which the plugins execute? I need Babel to run before ng-annotate, because ng-annotate does not understand ES6 as yet. For the moment, we can work around the one file extension per plugin issue by simply calling several convertors (transpiler, annotation, etc) in sequence within the one Meteor plugin. I was also thinking about creating a generic plugin that would allow me to add several steps to it. Perhaps the plugin itself could have a "plug-in" design, that allows me to hook steps into it. I'll give it more thought... For now, I will create my own pbastowski:ng-babel package, which processes .es6 files and ng-annotates them all in one. I want to publish it to Atmosphere for others to use, but I have to work out how to publish Meteor packages first. |
My angular-babel package is on Atmosphere. Look for pbastowski:angular-babel. My first Meteor package :) Mostly ripped off grigio:babel, though. |
Awesome @pbastowski. |
👍 so good! |
For those using mquandalle:harmony and also in need of As my project heavily relies on ES6 |
Hi @jasperkuperus. If you ever want to try Babel, I have a Meteor module defectModel.es6.js export class defectModel { ... } and in defect.es6.js import defectModel from 'defectModel';
class defect extends defectModel { ... } |
@pbastowski thanks! I might try that one day! :) |
I know it's being discussed at #109 and meteor/meteor#3508 but it looks like we have to wait until they find a way to process the original .js files.
So hence my PR as a suggestion: why for now not register
ng.js
to be processable by ng-annotate? It would make my project a lot easier to work with.In addition, we could do more processing on this extension such as https://github.com/werk85/grunt-ng-constant.