-
Notifications
You must be signed in to change notification settings - Fork 339
Data attributes containing angular "hidden" fields (e.g. data-smth="obj.$$field") are mistakenly stripped of the second $ #480
Comments
@ptanov not sure if we need to added it to fileprocessor as it is a non standard attribute. But you can still provide you regexp to
By the way I would use the following regexp, as your are using angular: This gives the following configuration:
|
Hello @stephanebachelier, Thank you! |
@ptanov I see. IMO the fileprocessor regexps are standard while any non standard regexp or specific filter should be given by user. @sindresorhus what do you think about it ? |
@stephanebachelier, I think that we are talking about different things. Thank you. |
@ptanov thanks for your explanation. Now I understand your problem. Indeed it's a bug. Not sure if fileprocessor is involved or if it may be linked to another issue about usemin not correctly handling special characters. I would prefer not to touch to fileprocessor to add a new regexp, but needs to think about it. |
OK, thanks grunt-usemin/lib/fileprocessor.js Line 187 in 6119f90
to
I think this would not affect anything apart from the problem reported. Thanks |
@ptanov thanks for coming back, I will test this change. |
Linking this issue to html parser migration as it might solve this. see #244. |
@ptanov just to let you know that I'll test this problem and others issues related to the block replacement in the |
If in an html file processed by usemin there is something like this:
then the result will be:
(without the double $)
The attribute is matched by this pattern:
then in
grunt-usemin/lib/fileprocessor.js
Line 207 in 1b5fcef
match is data-ng-model="obj.$$field"
src is obj.$$field
filterOut(file) is obj.$$field
and res is obj.$field
This is because the symbol $ is used for groups, e.g. $1, $2, etc. ( see https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions#special-capturing-parentheses ). I can see that the symbol $ is escaped with a second $ (but I can't find where this is actually noted in the specification).
In order to use usemin task I have copied the default html patterns in my gruntfile and then I have explicitly set filterOut (rxl[3]):
instead of using default case:
The whole grunt configuration:
This function should be added in all patterns. I hope you understand what I'm trying to explain here.
Thanks
The text was updated successfully, but these errors were encountered: