-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
The plugin does not honour the stringMap directive. #242
Comments
Hi @3baaady07,
To use a Here you have a working example with your CSS code: https://runkit.com/embed/wxaht3xnjabj
|
Hi @elchininet. import postcssRTLCSS from 'postcss-rtlcss';
import { Autorename } from 'postcss-rtlcss/options';
export default {
plugins: {
autoprefixer: {},
['postcss-rtlcss']: postcssRTLCSS({
autoRename: Autorename.strict,
stringMap: [
{
name: 'prev-next',
search: 'prev',
replace: 'next'
}
]
})
},
} Maybe this would shed light on where exactly I went wrong? Another note is that based on the |
Hi @3baaady07,
Is
|
Hi @elchininet,
The plugin works as expected (prepending the html attribute
The I'll open an issue with Bootstrap about this but I have more faith in this plugin.. 😄 |
Hi @3baaady07, I would need a minimum reproducible example in a repo to debug it, otherwise it is very difficult to know what could be happening. Just make sure that those rules do not contain directional properties, About adding the directives in SASS, just make sure that you are adding them in this way. |
Hi @elchininet, I have added a basic repo that illustrates the issue. The detailed reproducible steps are described in the Cheers, :) |
Hi @3baaady07, Plugins as an objectimport { Autorename } from 'postcss-rtlcss/options';
export default {
plugins: {
'postcss-rtlcss': {
autoRename: Autorename.strict,
stringMap: [
{
name: 'prev-next',
search: 'prev',
replace: 'next'
}
]
}
}
} Plugins as an arrayimport postcssRTLCSS from 'postcss-rtlcss';
import { Autorename } from 'postcss-rtlcss/options';
export default {
plugins: [
postcssRTLCSS({
autoRename: Autorename.strict,
stringMap: [
{
name: 'prev-next',
search: 'prev',
replace: 'next'
}
]
})
]
} |
Hi @3baaady07, Check this pull request, read the statement and let me know if it is clear and would solve your use case. |
hi @elchininet,
That actually fixed it 👍 For example: /* I want to change those */
.test2-right::before {
content: "\f007";
}
.test2-left::before {
content: "\f010";
}
/* ...but not those */
.hand-right {
background-image: url("images/hand-right-[hash].png");
}
.hand-left{
background-image: url("images/hand-left-[different hash].png");
} Sorry if this sounds like a convoluted request. |
Hi @3baaady07, You can use the rtl:ignore directives for that: /* I want to change those */
.test2-right::before {
content: "\f007";
}
.test2-left::before {
content: "\f010";
}
/* ...but not those */
/*rtl:begin:ignore*/
.hand-right {
background-image: url("images/hand-right-[hash].png");
}
.hand-left{
background-image: url("images/hand-left-[different hash].png");
}
/*rtl:end:ignore*/ But just in case that you want to ignore it in the whole file and just apply it to some rules, I have plans of creating a directive for that once the new version is released. But remember that you can use what I recomended you here with the current version of the library without setting any option: https://www.sassmeister.com/gist/9a7c50edd00fa7ae68616b711816e8b5 |
This is the exact solution I proposed to Bootstrap in this PR. Hopefully they will merge it because the library is downloaded as part of the CD pipeline Thank you @elchininet. Cheers. |
Hi @3baaady07,
Result before the pull request:/* Input */
.carousel-control-prev-icon {
// prev-content
}
.carousel-control-next-icon {
// next-content
}
/* Output */
.carousel-control-next-icon {
// prev-content
}
.carousel-control-prev-icon {
// next-content
} Result after the pull request:/* Input */
.carousel-control-prev-icon {
// prev-content
}
.carousel-control-next-icon {
// next-content
}
/* Output */
.carousel-control-prev-icon {
// next-content
}
.carousel-control-next-icon {
// prev-content
} By the way, after this pull request is merged and released, you will have the ability of applying the |
Hi @elchininet ,
I believe the resulting file will be different with the proposed PR. You illustrated this in your The idea is as follows... /* Input */
.carousel-control-prev-icon {
// prev-content /* rtl:{next-content} */
}
.carousel-control-next-icon {
// next-content /* rtl:{prev-content} */
}
/* Output */
[dir=ltr] .carousel-control-prev-icon {
// prev-content
}
[dir=ltr] .carousel-control-next-icon {
// next-content
}
[dir=rlt] .carousel-control-prev-icon {
// next-content
}
[dir=rlt] .carousel-control-next-icon {
// prev-content
} Am I missing something? |
It would work if you use the bootstrap uncompiled source file, but if you use the CSS files that bootstrap provides, they will not have the directives there, so you will get the same result but just in a different order. |
As can be seen from the illustration, the string highlighted is the same after being processed, and the selector as well is not changed.
before
After
The text was updated successfully, but these errors were encountered: