Skip to content
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

Implement new directives to control processRuleNames option #248

Merged
merged 1 commit into from Dec 30, 2023

Conversation

elchininet
Copy link
Owner

This pull request implements new directives to control the processRuleNames option.

/*rtl:rules*/

This directive set the processRuleNames option to true in the next rule no mattering the value of the global processRuleNames option:

input
/*rtl:rules*/
.test1-ltr {
    background-image: url('/images/test1-l.png');
}

/*rtl:rules*/
.test1-rtl {
    background-image: url('/images/test1-r.png');
}

/*rtl:rules*/
.test2-left::before {
    content: "\f007";
}

.test2-right::before {
    content: "\f010";
}
output
[dir="ltr"] .test1-ltr {
    background-image: url('/images/test1-l.png');
}

[dir="rtl"] .test1-ltr {
    background-image: url('/images/test1-r.png');
}

[dir="ltr"] .test1-rtl {
    background-image: url('/images/test1-r.png');
}

[dir="rtl"] .test1-rtl {
    background-image: url('/images/test1-l.png');
}

/* These selectors will not be processed because only one of them has the rtl:rules directive */
.test2-left::before {
    content: "\f007";
}

.test2-right::before {
    content: "\f010";
}

/*rtl:begin:rules*/ and /*rtl:end:rules*/

These directives should be used together, they will provide the beginning and the end for processRuleNames blocks.

input
.test1-ltr {
    background-image: url('/images/test1-l.png');
}

.test1-rtl {
    background-image: url('/images/test1-r.png');
}

/*rtl:begin:rules*/
.test2-left::before {
    content: "\f007";
}

.test2-right::before {
    content: "\f010";
}
/*rtl:begin:rules*/
output
.test1-ltr {
    background-image: url('/images/test1-l.png');
}

.test1-rtl {
    background-image: url('/images/test1-r.png');
}

[dir="ltr"] .test2-left::before {
    content: "\f007";
}

[dir="rtl"] .test2-left::before {
    content: "\f010";
}

[dir="ltr"] .test2-right::before {
    content: "\f010";
}

[dir="rtl"] .test2-right::before {
    content: "\f007";
}

@elchininet elchininet added documentation Improvements or additions to documentation enhancement New feature or request labels Dec 30, 2023
@coveralls
Copy link

Coverage Status

coverage: 100.0%. remained the same
when pulling 2eb7e19 on add_rules_directive
into 349e04f on master.

@elchininet elchininet merged commit f900892 into master Dec 30, 2023
2 checks passed
@elchininet elchininet deleted the add_rules_directive branch December 30, 2023 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants