Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Build pattern regex doesn't support url path with space #512

Closed
JackZhang1988 opened this issue Feb 10, 2015 · 6 comments
Closed

Build pattern regex doesn't support url path with space #512

JackZhang1988 opened this issue Feb 10, 2015 · 6 comments
Assignees
Labels

Comments

@JackZhang1988
Copy link

My build comment template in my html like this:

<!-- build:css <%- staticBase%>/css/index/index.css -->
<link href="<%- staticBase %>/css/common/base.css<%- version %>" type="text/css" rel="stylesheet">
<link href="<%- staticBase %>/css/index/index.css<%- version %>" type="text/css" rel="stylesheet">
<link href="<%- staticBase %>/css/common/itemListTemplate.css<%- version %>" type="text/css" rel="stylesheet">
<!-- endbuild -->

the staticBase variable is the DNSUrl i will render by grunt template, the first line <!-- build:css <%- staticBase%>/css/index/index.css --> , you can see there is a space before word staticBase, but the usemin build pattern can't parse this pattern.

I check the usemin rebuild pattern is /<!--\s*build:(\w+)(?:\(([^\)]+)\))?\s*([^\s]+)\s*-->/, it does't support build path with a space, when i remove the space before staticBase word, it works fine.

@stephanebachelier
Copy link
Collaborator

@JackZhang1988 the problem is that the third group in the regexp, which is ([^\s]+), exclude any space.

@stephanebachelier
Copy link
Collaborator

@JackZhang1988 can you test the branch in #516 to see if it fixes your use case. I don't know if it also related to your other issue #513

@stephanebachelier
Copy link
Collaborator

@JackZhang1988 see my comment in your other issue.

@stephanebachelier
Copy link
Collaborator

@JackZhang1988 could you explain why you would want to have your path being variable ?
I need to have more information on your use case.
Seeing that you have <%- version %>, I think you're missing the point of usemin whose job is to optimize your page, so it need to know where are your assets.

I'm closing this issue as irrelevant. Feel free to come back with more explanations and reopen if needed.

@JackZhang1988
Copy link
Author

@stephanebachelier sorry for replaying so late, the variable for path used for static files' CDN path, usually we develop our project in local, this variable will be 'localhost', when our project release to internet, this variable will be the CDN path.

i know there maybe other way to accomplish this, but when i join my team, it has used this way.

@stephanebachelier
Copy link
Collaborator

@JackZhang1988 maybe you should use another plugin that will replace all the paths of the assets, but once usemin have processed your files.

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

Successfully merging a pull request may close this issue.

2 participants