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

Useref doesn't parse block with no space in comments #40

Open
mike1808 opened this issue Apr 27, 2015 · 0 comments
Open

Useref doesn't parse block with no space in comments #40

mike1808 opened this issue Apr 27, 2015 · 0 comments

Comments

@mike1808
Copy link

I am trying to parse the following html

<!-- build:js scripts/combined.concat.min.js-->
<!-- some comment -->
<script type="text/javascript" src="scripts/this.js"></script>

<script type="text/javascript" src="scripts/that.js"></script>
<!-- endbuild-->

As you can see there are no spaces after scripts/combined.concat.min.js and that's why the parsed html looks like this (the value of the "parsed" variable from src/index.js 178:7)

{
    "type": "js",
    "target": "scripts/combined.concat.min.js-->",
    "attbs": "<!-- some comment"
}

I found that the reason in the following part of the "regbuild" regular expression

var regbuild = /<!--\s*build:(\w+)(?:\(([^\)]+)\))?\s*([^\s]+)?\s*(?:(.*))?\s*-->/;

The attribute group is not lazy. Making it lazy solves this issue, however, there are tests that fail.

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

1 participant