You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The map should replace @import url(common.css); with @import url(common-rtl.css);. That works great.
But the map also changes @import url("//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,600,700");
to @import url("//fonts.googleapis.com.css?family=Open+Sans:400italic,700italic,400,600,700");
(Note the slash which is replaced with a dot.)
Since search and replace is passed to RegExp I have escaped the dot (search: [ '\.css' ]) but stil getting the same output.
Any idea what the issue is?
The text was updated successfully, but these errors were encountered:
Your search term will match any character followed by "css"
"a.b/css".match(/(.css)/);` // will match "/css""a.css".match(/(.css)/);`// will match ".css"
Using the examples you provided, escaping the dot (search:'\\.css') will work with @import url("//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,600,700"); because there will be no match. But will fail in @import url(common.css);, since the match .css will be replaced by the search term "\.css" producing @import url(common\.css);
This is because the StringMap is bi-directional, it matches both search and replace then checks if the match is equal to search term, if yes its replaced with replace term, if not it will assume the match was for the replace term and replace it with search term.
Not sure if the explanation was clear enough! But I should have escaped the stringMap terms internally from the start.
I have this map:
The map should replace
@import url(common.css);
with@import url(common-rtl.css);
. That works great.But the map also changes
@import url("//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,600,700");
to
@import url("//fonts.googleapis.com.css?family=Open+Sans:400italic,700italic,400,600,700");
(Note the slash which is replaced with a dot.)
Since
search
andreplace
is passed to RegExp I have escaped the dot (search: [ '\.css' ]
) but stil getting the same output.Any idea what the issue is?
The text was updated successfully, but these errors were encountered: