Skip to content

Commit

Permalink
perf(index): change improves regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Dec 9, 2016
1 parent 4063571 commit 9de0a67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const filter = (filter, attributeSelector) => new RegExp(filter.map(attribut =>
export default postcss.plugin('postcss-attribute-selector-prefix', options => {
return nodes => {
return nodes.walkRules(rule => {
rule.selector = rule.selector.replace(/\[.*?\]/g, match => {
rule.selector = rule.selector.replace(/\[.*?]/g, match => {
if (options.prefix === undefined) {
return match;
}
Expand All @@ -18,7 +18,7 @@ export default postcss.plugin('postcss-attribute-selector-prefix', options => {
return match;
}

return match.replace(/(\[.*?="?)(.*?)("?\])/, (match, before, required, after) => {
return match.replace(/(\[.*?="?)(.*?)("?])/, (match, before, required, after) => {
return `${before}${options.prefix}${required}${after}`;
});
});
Expand Down

0 comments on commit 9de0a67

Please sign in to comment.