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

Stip of the last <include> block header when writing deps to the same file #29

Open
wingedfox opened this issue Dec 1, 2014 · 6 comments

Comments

@wingedfox
Copy link

In certain cases, not studied exactly, but happens quite often, plugin strips last include block.
Guess, this happens when file contains more than one include blocks and plugin does a lot of changes.

Source file contains

      <!-- build:js({.tmp,app}) /scripts/scripts.js -->
        <!-- include: "type": "js", "files": "scripts/*.js" -->
        <!-- /include -->

        <!-- include: "type": "js", "files": "scripts/service/**/*.js" -->
        <!-- /include -->

        <!-- include: "type": "js", "files": "scripts/directives/**/*.js" -->
        <!-- /include -->

        <!-- include: "type": "js", "files": "scripts/controllers/**/*.js" -->
        <!-- /include -->

        <!-- include: "type": "js", "files": "modules/**/*.js" -->
        <!-- /include -->

      <!-- endbuild -->

Sometimes the very last block is getting rewritten as follows

        <!-- /include -->

        <script src="modules/core/core.js"></script>
        <script src="modules/core/loader.js"></script>
        <script src="modules/core/core.js"></script>
        <script src="modules/core/loader.js"></script>
        <!-- /include -->

I'll take a closer look in which case this happens, but it surely happens quite often, once in 3-4 days at least.

@jwvdiermen
Copy link
Owner

Sounds like a strange issue. Let me know when you can reproduce this.

If anyone else has this issue, let me know. If so, I'll have a look at it.

@wingedfox
Copy link
Author

I can confirm this now.
Still had no chance to investigate this to make exact steps to reproduce, but met it about 10 times in the last week on the windows and ubuntu.
It seems that this happens only when upper includes has massive changes and with the very last block only.

@manuelnaranjo
Copy link

Actually this is pretty easy to reproduce, just chage index.html in the test directory, make sure the last statemente is as follows:

<!-- include: "type": "js", "files": ["js/_first.js","js/lib/**/*.js","<%= vars.jsPath %>/main.js"], "basePath":  "<%= vars.multipleBasePath %>" -->
    <script src="js/lib/dep1.js"></script>
<!-- /include -->

And it will create the following output:

<!-- include: "type": "js", "files": ["js/_first.js","js/lib/**/*.js","<%= vars.jsPath %>/main.js"], "basePath":  "<%= vars.multipleBasePath %>" -->
    <script src="js/_first.js"></script>
    <script src="js/lib/dep1.js"></script>
    <script src="js/lib/dep2.js"></script>
    <script src="js/main.js"></script>
<!-- /include -->

Noticed it didn't keep the order as dep1 should be first.

I'm investigating this issue as this is very important for me to get fixed, otherwise my AngularJS apps break.

@manuelnaranjo
Copy link

Sorry my last comment was not related to this issue, I'm experiencing the ordering issue as well, will create a new issue for it.

@jwvdiermen
Copy link
Owner

Well, the point of the <!-- /include --> tag is so you can rewrite the same html file without needing an separate output file. It doesn't remember anything inside of the tag, meaning it works like it's designed to in your case.

@manuelnaranjo
Copy link

Indeed, ordering needs to be handled outside the plugin scope.

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

No branches or pull requests

3 participants