maping through nested rules#2935
Closed
makbari wants to merge 2 commits intoGrapesJS:devfrom
makbari:nested-at-rules
Closed
maping through nested rules#2935makbari wants to merge 2 commits intoGrapesJS:devfrom makbari:nested-at-rules
makbari wants to merge 2 commits intoGrapesJS:devfrom
makbari:nested-at-rules
Conversation
artf
requested changes
Aug 26, 2020
Member
artf
left a comment
There was a problem hiding this comment.
Can you please explain the point of this PR? What are you trying to solve?
| const selectorStrNoAdd = rule.selectorsToString({ skipAdd: 1 }); | ||
| const selectorsAdd = rule.get('selectorsAdd'); | ||
| const singleAtRule = rule.get('singleAtRule'); | ||
| let isGjsRule = false; |
Member
There was a problem hiding this comment.
what is the point of this variable? Seems like you don't use it...
| const atRuleKeys = keys(atRules); | ||
| const singleAtRules = ['5', '6', '11', '15']; | ||
| const singleAtRulesNames = ['font-face', 'page', 'counter-style', 'viewport']; | ||
| const singleAtRulesNames = ['font-face', 'counter-style', 'viewport']; |
|
|
||
| if ((selectorStrNoAdd && found) || selectorsAdd || singleAtRule) { | ||
| const block = rule.getDeclaration(); | ||
| if ((selectorStrNoAdd && found) || selectorsAdd || singleAtRule || rule.attributes.style) { |
Member
There was a problem hiding this comment.
rule.attributes.style is an object, it's a truthy value, so the condition is pointless
| if ((selectorStrNoAdd && found) || selectorsAdd || singleAtRule || rule.attributes.style) { | ||
| const entries = Object.entries(rule.attributes.style); | ||
| const styleStr = entries.length > 0 ? entries.map(([k, v]) => `${k}:${v}`).join(';') + ';' : ''; | ||
| const block = rule.getDeclaration().length > 0 ? rule.getDeclaration() : styleStr; |
Member
There was a problem hiding this comment.
You're calling rule.getDeclaration() twice and honestly, I don't understand the point of this change
Author
|
Thanks for the review. I will make some correction and more updates. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is integration of the nested rules. When nested at rules is parsed from grapesjs-parset-postcss, grapes js resolve them.
an example is also provided in the postcss repo.