Control Directives
Control directives are placed between declarations or statements (rules and at-rules). They can target a single node (self-closing) or a set of nodes (block-syntax).
Name | Syntax | Description |
---|
Ignore | /*rtl:ignore*/ | Ignores processing of the following node (self-closing) or nodes within scope (block-syntax). |
Config | /*rtl:config:{OBJECT}*/ | Evaluates the {OBJECT} parameter and updates current RTLCSS config*1. |
Options | /*rtl:options:{JSON}*/ | Parses the {JSON} parameter and updates current RTLCSS options*2. |
Raw | /*rtl:raw:{CSS}*/ | Parses the {CSS} parameter and inserts it before the comment node that triggered the directive*3. |
Remove | /*rtl:remove*/ | Removes the following node (self-closing) or nodes within scope (block-syntax). |
Rename | /*rtl:rename*/ | Renames the selector of the following rule (self-closing) or rules within scope (block-syntax) by applying String Map. |
- 1 Config is evaluated using
eval
, and it can be disabled by adding it to the blacklist
. - 2 Options parsing is done via
JSON.parse
, and requires a valid json. The new options will override the defaults (not the current context). Plugins will be carried over from the current context. - 3 Due to the nature of RAW directive, block-syntax is not supported.
Ignore
Syntax | Description |
---|
/*rtl:ignore*/ | Ignores processing of the following node or nodes within scope. |
Example
.code {
direction:ltr;
text-align:left;
}
.code {
direction:ltr;
text-align:left;
}
Config
Syntax | Description |
---|
/*rtl:config:{OBJECT}*/ | Evaluates the {OBJECT} parameter and updates current configuration. |
The {OBJ}
parameter is evaluated using javascript eval
, if you with to disable it, simply add it to the blacklist
.
Example
.example {
...
}
.example {
...
}
Options
Syntax | Description |
---|
/*rtl:options:{JSON}*/ | parses the {JSON} parameter and updates current RTLCSS options. |
Options parsing is done via JSON.parse
, and requires a valid json object.
The new options will override the defaults (not the current context). Plugins will be carried over from the current context.
Example
.demo-left { content: 'left'; }
.demo-right { content: 'right'; }
Self-closing options will remain active from this point forward.
.demo-prev, .demo-Prev, .demo-PREV { content: '<'; }
.demo-next, .demo-Next, .demo-NEXT { content: '>'; }
Raw
Syntax | Description |
---|
/*rtl:raw:{CSS}*/ | Parses the {CSS} parameter then inserts it before the comment node. |
Example
Due to the nature of RAW directive, block-syntax is not supported.
Remove
Syntax | Description |
---|
/*rtl:remove*/ | Removes the following node (self-closing) or nodes within scope (block-syntax). |
Example
div {
direction: rtl;
text-align: right;
padding: 10px;
}
div {
direction: rtl;
text-align: right;
padding: 10px;
}
Rename
Syntax | Description |
---|
/*rtl:rename*/ | Renames the selector of the following rule (self-closing) or rules within scope (block-syntax) by applying String Map. |
Example
.float-right {
float: right;
}
.float-right {
float: right;
}
.float-left {
float: left;
}
PREVNEXT