Your guide on how to use and make the most out of RTLCSS
Hooks provides you with the ability to manipulate the css before/after it is processed, The hooks object has two keys
Property | Type | Description |
---|---|---|
pre | function | The function to be called before processing the CSS. |
post | function | The function to be called after processing the CSS. |
When a hook is called, it will be passed the Root node along with PostCSS instance.
var hooks = {
post:function(root, postcss){
root.insertBefore(root.nodes[0], postcss.comment({text: 'Generated by RTLCSS'}))
}
}
rtlcss.process(css, options, plugins, hooks)
Input CSS:
body { direction:ltr;}
Output CSS:
/*Generated by RTLCSS*/
body { direction:rtl;}