-
-
Notifications
You must be signed in to change notification settings - Fork 39
Fix #90 - whitespace between mixin and !important is optional #91
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
Conversation
lib/less-parser.js
Outdated
@@ -116,7 +116,7 @@ export default class LessParser extends Parser { | |||
|
|||
if (node.selector.indexOf('!important') >= 0) { | |||
node.important = true; | |||
node.selector = node.selector.replace(/\s!important/, ''); | |||
node.selector = node.selector.replace(/\s*!important/, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this regex be /(\s+)?!important/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's equivalent, no? We can also use /\s?!important/
but I though it would make sense to eat as much whitespace as possible here
lib/less-parser.js
Outdated
@@ -114,9 +114,9 @@ export default class LessParser extends Parser { | |||
// eslint-disable-next-line | |||
delete this.current.nodes; | |||
|
|||
if (node.selector.indexOf('!important') >= 0) { | |||
if (node.selector.match(/!important/i)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be .test
as you don't care about the result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
Fixes #90
Please check one:
This PR:
Hope this looks good to you, I'm no JS nor parser expert