Reputation:
Can you configure rtlcss to ignore specific css properties across all files?
I know you can use the control directives to ignore individual code blocks, but I can't find in the documentation how you can exclude css properties across the entire file/directory. Preferrably using CLI.
For example, I want to exclude background-position
from being changed. How can I do that?
Edit: I just found out I need to write a plugin to do this. I will try it out. https://rtlcss.com/learn/extending-rtlcss/declaration-processor/
Upvotes: 0
Views: 250
Reputation: 104
I solved the problem via a plugin like this:
rtlcss.process(content, {}, [
{
name : 'ignore-background',
priority : 99, // above the core RTLCSS plugin which has a priority value of 100
directives : {
control : {},
value : []
},
processors : [{
expr : /(background|object)(-position(-x)?|-image)?$/i,
action : (prop, value) => ({prop, value})}
]
}
]);
If you are using postcss-rtlcss
, you need to wait for the PR to support specifying plugins or hooks, or directly use @aleen42/postcss-rtlcss
temporarily.
Upvotes: 0