Closed febeling closed 3 years ago
Thanks for the patch, but I'll give you the same speech I give everyone who submits PRs for generating custom JS: there's no way we can support generating JS that supports everyone's use case. The JS ecosystem is just too vast. But what we can, and do, support is generating JSON which you can then consume or transform yourself.
On Sunday, July 26, 2015, Florian Ebeling notifications@github.com wrote:
Browserify needs to require Angular's global before using it. Add an option to pass in the expression to do that.
The usage in the Gruntfile.js might look like this:
nggettext_compile: { all: { files: { 'app/scripts/translations.js': ['po/*.po'] }, options: { angular: 'require(\'angular\')' } } },
You can view, comment on, or merge this pull request online at:
https://github.com/rubenv/angular-gettext-tools/pull/102 Commit Summary
- feat(compiler): add support for browserify
File Changes
- M lib/compile.js https://github.com/rubenv/angular-gettext-tools/pull/102/files#diff-0 (5)
- M test/compile.js https://github.com/rubenv/angular-gettext-tools/pull/102/files#diff-1 (38)
Patch Links:
- https://github.com/rubenv/angular-gettext-tools/pull/102.patch
- https://github.com/rubenv/angular-gettext-tools/pull/102.diff
— Reply to this email directly or view it on GitHub https://github.com/rubenv/angular-gettext-tools/pull/102.
As I see it, there are three approaches for client side modules that are used in the field right now: browser globals, AMD and CommonJS. You support two of them with the released version, globals and AMD. Why not complete this list by adding CommonJS?
That's a valid argument, although I would add es6 modules to that list. And for what it's worth I think adding AMD support was a mistake for us. The JS should just to be for getting started quickly. If you need anything custom then write the JS yourself and load in the JSON.
On Sunday, July 26, 2015, Florian Ebeling notifications@github.com wrote:
As I see it, there are three approaches for client side modules that are used in the field right now: browser globals, AMD and CommonJS. You support two of them with the released version, globals and AMD. Why not complete this list by adding CommonJS?
— Reply to this email directly or view it on GitHub https://github.com/rubenv/angular-gettext-tools/pull/102#issuecomment-125030574 .
I agree that the requirejs
option is a little bit too specialized. One way to go about it would be to deprecated that one and advise people to always use the proposed API for generating JS.
I picked the name with some of that in mind already. The option isn't called bowerserify
for that reason. It can be used to generate JS compatible with amd, commonjs, es6 (I believe) and browser global, and it already has 'angular' as default.
Browserify needs to require Angular's global before using it. Add an option to pass in the expression to do that.
The usage in the
Gruntfile.js
might look like this: