jvandemo / generator-angularjs-library

A generator for Yeoman to generate the boilerplate for creating an AngularJS library
117 stars 33 forks source link

Could you add documentation on the files generated #2

Closed ceoaliongroo closed 11 years ago

ceoaliongroo commented 11 years ago

Hi,

Great work with your repo, i like the idea to use yours instead others because the organization of the code. But it's kind of confusing

Could you explain with you copy this file in the generator?

| |---- yourLibraryName.prefix | |---- yourLibraryName.suffix

Thanks

jvandemo commented 11 years ago

Hi Carlos,

Thank you for your kind words.

The .prefix and .suffix files are generated to wrap the concatenated source files in the build process.

Here's what happens during concatenation:

.prefix file is added:

(function(window, document) {

then all library files are added:

// All the code your wrote

and finally .suffix file is added:

})(window, document);

Resulting in a distribution file that looks like this:

(function(window, document) {

    // All the code your wrote

})(window, document);

This allows us to wrap the complete library in an anonymous function so the library has no impact on the global namespace.

I will add this to the documentation as well.

Hope that helps!

Jurgen

eddiemonge commented 11 years ago

Why is document passed in?

jvandemo commented 10 years ago

window and document have been removed in v2.

rony76 commented 9 years ago

Would these two wrapper files be a good place to transform the generated library into an AMD module?

jvandemo commented 9 years ago

@rony76, the wrapper files will no longer be necessary in future releases so I wouldn't recommend using them.

The new AngularJS styleguide makes them obsolete so they will disappear in the next major release. Thanks!