Skip to content
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

Merge source and include types so order can be preserved #6

Closed
blutorange opened this issue Oct 14, 2018 · 2 comments
Closed

Merge source and include types so order can be preserved #6

blutorange opened this issue Oct 14, 2018 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@blutorange
Copy link
Owner

Issue by nedjs
Friday Mar 20, 2015 at 00:03 GMT
Originally opened as samaxes#93


When aggregating multiple files some of which are already minified and shouldn't be hit with a 2nd round you might do the following

<jsSourceFiles>
    <jsSourceFile>app.js</jsSourceFile>
    <jsSourceFile>zones.js</jsSourceFile>
</jsSourceFiles>
<jsIncludeFiles>
    <jsIncludeFile>jquery.min.js</jsIncludeFile>
</jsIncludeFiles>

What happens is the source files get minified then merged with items listed inside jsIncludeFiles as expected from the documentation. The output file would be an aggregation of the files in the following order:

  • app.js
  • jquery.min.js
  • zones.js

Of course if you have any JQuery references in app.js then your going to have problems.


You might solve this by changing the xml structure to allow for includes and sources to be under the same tree. However I dont know how your code is operating behind the scenes so maybe a different option is more feasible.

Something like this:

<jsFiles>
    <jsIncludeFile>jquery.min.js</jsIncludeFile>
    <jsSourceFile>app.js</jsSourceFile>
    <jsSourceFile>zones.js</jsSourceFile>
</jsFiles>
@blutorange
Copy link
Owner Author

Comment by sniederb
Friday Jul 08, 2016 at 09:10 GMT


I'm hitting the same problem. Defining a merge order while still using wildcards seems a rather common use case.

<jsSourceFiles>
    <jsSource>standard-lib1.js</jsSource>
    <jsSource>standard-lib2.js</jsSource>
    <jsSource>*Page.js</jsSource>
    <jsSource>backbone-router-def.js</jsSource>
</jsSourceFiles>

@blutorange blutorange added this to the 2.0.0 milestone Oct 14, 2018
@blutorange blutorange added the enhancement New feature or request label Oct 14, 2018
@blutorange
Copy link
Owner Author

blutorange commented Oct 14, 2018

There is now just the option includes, supporting wildcards. They are merged in the order as specified. So the following works:

<includes>
    <include>standard-lib1.js</include>
    <include>standard-lib2.js</include>
    <include>*Page.js</include>
    <include>backbone-router-def.js</include>
</includes>

Behind the scenes, this is what happens:

  • Look for all matches matching standard-lib1.js, call them FILES_A
  • Look for all matches matching standard-lib2.js, call them FILES_B
  • Look for all matches matching *Page.js, call them FILES_C
  • Look for all matches matching backbone-router-def.js, call them FILES_D
  • Merge files in the order A-B-C-D.

If there are any duplicate files, take the first one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant