Closed aleen42 closed 2 months ago
Hi @aleen42,
It is always recommended to discuss the intention of creating a feature before working on it, just to avoid working in vain.
If you want to support plugins and hooks, it cannot be done in that way that you did and you cannot link plugins and hooks of RTLCSS
. It will create confussion and it will be a source of issues because most of the things supported by RTLCSS
will not work with this plugin.
postcss-rtlcss
uses RTLCSS
behind the scenes, but this does not mean that it runs RTLCSS
in the entire CSS
input. RTLCSS
is used only on declarations, but it doesn‘t run in any other element (the CSS root element, the rules, at rules, comments, etc). This means that anything that a user sets inside directives
will potentially fail, I think that the only thing that will work without issues is the processors
property.
The same with hooks, as RTLCSS
is not executed in the CSS
root, most probably what RTLCSS
users expect from a hook will not work with postcss-rtlcss
. So, if you want to build hooks, most probably it should be built here from scratch (the same way the control directives and the stringMap
option are built from scratch).
Please, refactor this following the next:
RTLCSS
, create your own types. You need to test what works with the plugin and the things that don‘t work should be removed (most probably the only thing that will work will be the processors
property).RTLCSS
options because as the options will not work in the same way, it will create confussion.Regards and thanks for contributing to the project.
@elchininet Thanks for your review. I have eliminated the unnecessary hooks options because it seems we do not need to hook during processing CSS declarations via postcss-rtlcss
. The plugin options have been renamed as processDeclarationPlugins
which are currently only applied during processing declarations.
Hi @aleen42, Looks good to me. Update the branch (I think that you may get some merge conflicts). Regards
@aleen42, I think that it is ready to merge. Thanks for your contribution. I'll release a new version when I have a chance. Regards 👍🏼
Hi @aleen42, The feature has been released in version 5.3.0. Regards
This pull request implements an option named
processDeclarationPlugins
to support stepping into the process of processing CSS declarations, like avoiding flippingbackground-positions
.For instance,
RTLCSS
will flip thebackground-position
:input
Convert
0
to100%
(default)output
However, we may need to stop this unexpected flipping in the case of using it to clip Sprite images, so we can use this introduced option to avoid this:
output