Comments (14)
Bootstrap has many rules like that previous example.
@media (min-width: 768px) {
.navbar-left {
float: left !important;
}
.navbar-right {
float: right !important;
margin-right: -15px;
}
.navbar-right ~ .navbar-right {
margin-right: 0;
}
}
After conversion:
@media (min-width: 768px) {
.navbar-left {
float: right !important;
}
.navbar-right {
float: left !important;
margin-left: -15px;
}
.navbar-right ~ .navbar-right {
margin-left: 0;
}
}
from rtlcss.
This is the default behavior, see Why Auto Rename?
The rules you listed contain directional declarations and should not be auto renamed, I don't see why you need them both to be either renamed or ignored ?
from rtlcss.
Also see RTL-bootstrap, A complete RTL version generated using this tool (with autoRename
enabled).
from rtlcss.
Thank you for the quick response!
Becase it doesn't make sence to have a rule with name .text-left
which do the opposite text-align: right
. It is not just .text-left
, Bootstrap has many of these *-left
*-right
classes. We need them to do what they are supposed to do. navbar-left
, for example, is supposed to align an element to the left, not right.
.
Regarding RTL-bootstrap, I'm trying to process Bootstrap.css v3.3.6
using rtlcss cli with autoRename: true
. But I get this error:
Saving: /path/to/bootstrap.rtl.css
rtlcss: error processing file /path/to/bootstrap.css
TypeError: Cannot read property 'replace' of undefined
Also, see here. .navbar-left
causes float: right
. Which is weird.
from rtlcss.
The default behavior is better if all you want is to convert an existing bootstrap template with minimum modifications. Because you don't have to flip all *-left
and *-right
inside the html files.
But if you are building something from scratch, it is very annoying to use navbar-left
when you want it to float: right
!
from rtlcss.
Becase it doesn't make sence to have a rule with name .text-left which do the opposite text-align: right. It is not just .text-left, Bootstrap has many of these *-left *-right classes. We need them to do what they are supposed to do. navbar-left, for example, is supposed to align an element to the left, not right.
It makes sense when you want to use the same HTML markup! Hence, Why Auto Rename?
The default behavior is better if all you want is to convert an existing bootstrap template with minimum modifications. Because you don't have to flip all *-left and *-right inside the html files.
But if you are building something from scratch, it is very annoying to use navbar-left when you want it to float: right!
The intended use of this tool is to automatically create the RTL counterpart from your LTR stylesheet! If you are creating an RTL version from scratch, then its not wise to use it!
Seems there is an error with the new CLI, I'll fix soon.
Thanks!
from rtlcss.
Moreover, to rename or ignore them both, you can use directives:
require("rtlcss").process(`/*rtl:rename*/.text-left {
text-align: left;
}`, {
autoRename: false
});
// ".text-right {\n text-align: right;\n}"
or
require("rtlcss").process(`/*rtl:ignore*/.text-left {
text-align: left;
}`);
//".text-left {\n text-align: left;\n}"
from rtlcss.
Yes I'm creating an RTL version from scratch. But it is much more easier to use an RTL version of bootstrap itself. In this case, we need to use navbar-left
and get float: left
and so on.
Directives seem good. But I think there is something better to be done. Maybe a new option to ignore rules with left, right, rtl, ltr... etc
and have directional declarations.
Thank you again :) .
from rtlcss.
I can't reproduce the CLI issue on my development machine, would you please provide me with node/npm/rtlcss versions:
npm -v
node -v
rtlcss -v
from rtlcss.
npm -v
3.3.12
rtlcss -v
rtlcss version: 2.0.0
Node.js: both v4.3.0
and v5.5.0
. I'm using Ubuntu 14.04.
And here is .rtcssrc
file:
{
"options": {
"autoRename": true,
"autoRenameStrict": true,
"blacklist": {},
"clean": true,
"greedy": false,
"processUrls": false,
"stringMap": []
},
"plugins": [],
"map": false
}
from rtlcss.
Thanks for the config, the bug was caused by @font-face { ... }
as it contains decl
nodes, autoRename
assumed declarations only existed inside rule
nodes.
Fix released in 2.0.1
from rtlcss.
Maybe a new option to ignore rules with left, right, rtl, ltr... etc and have directional declarations.
@OsamaAbbas You can do another rename by adding your own plugin, see https://tonicdev.com/mohammad/rtlcss-rename-all
from rtlcss.
Thank you for the last commit. It works now.
And I've used one of the default directives, It worked too!
/*rtl:begin:rename*/
/*
* here goes the whole bootstrap file!
*/
/*rtl:end:rename*/
from rtlcss.
Yup! that gives the same result 👍
from rtlcss.
Related Issues (20)
- Ignore import not working HOT 5
- The background-position declarations are flipped differently on version v4.0.0 HOT 3
- background-position: HOT 2
- Integrating with Codeigniter
- Bootstrap 5.2 LTR and RTL at the same time (scss with Laravel vite) HOT 14
- using blacklist HOT 3
- aliases options don't work HOT 1
- Don't process data URLs
- Support src() with processUrls
- processUrls shouldn't process non-URL expressions in at-rules
- Bootstrap RTL and LTR at the same time HOT 2
- Unknown word error when "//' is used for commenting in scss files. HOT 1
- issue with media queries and onlyDiff option HOT 1
- This rtlcss package how to use in Laravel vite.config.js HOT 2
- RTLCSS Online
- RTLCSS errors when processing a value directive marked as important
- Tabbed menu not compatible HOT 5
- Can't deal with CSS
- Can't handle CSS style without semicolon HOT 2
- After compilation, ignore is invalid HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rtlcss.