55[ ![ Windows Build Status] [ win-img ]] [ win-url ]
66[ ![ Gitter Chat] [ git-img ]] [ git-url ]
77
8- [ PostCSS Logical Properties] lets you use nearly 60 new [ logical properties ]
9- and a half dozen flow-relative values in CSS .
8+ [ PostCSS Logical Properties] lets you use Logical Properties and Values in
9+ CSS, following the [ CSS Logical Properties and Values Level 1 ] specification .
1010
1111``` css
1212.banner {
@@ -34,6 +34,15 @@ and a half dozen flow-relative values in CSS.
3434.banner {
3535 resize : vertical ;
3636}
37+
38+ /* used with { dir: 'ltr' } option */
39+
40+ .banner {
41+ color : #222222 ;
42+ top : 0 ; left : 5px ; bottom : 10px ; right : 5px ;
43+ padding-left : 20px ; padding-right : 40px ;
44+ resize : vertical ;
45+ }
3746```
3847
3948These shorthand properties set values for physical properties by default.
@@ -85,15 +94,25 @@ properties:
8594
8695---
8796
88- [ PostCSS Logical Properties] changes the selector weight of flow-relative
89- declarations and requires at least one [ dir] attribute in your HTML. If you
90- don’t have any [ dir] attributes, consider using the following JavaScript:
97+ By default, [ PostCSS Logical Properties] changes the selector weight of
98+ flow-relative declarations and requires at least one [ dir] attribute in your
99+ HTML. If you don’t have any [ dir] attributes, consider using the following
100+ JavaScript:
91101
92102``` js
93103// force at least one dir attribute (this can run at any time)
94104document .documentElement .dir = document .documentElement .dir || ' ltr' ;
95105```
96106
107+ Otherwise, consider using the ` dir ` option to transform all logical properties
108+ and values to a specific direction.
109+
110+ ``` js
111+ require (' postcss-logical' )({
112+ dir: ' ltr'
113+ });
114+ ```
115+
97116## Usage
98117
99118Add [ PostCSS Logical Properties] to your build tool:
@@ -122,7 +141,7 @@ Use [PostCSS Logical Properties] as a plugin:
122141
123142``` js
124143postcss ([
125- require (' postcss-logical' )()
144+ require (' postcss-logical' )(/* options */ )
126145]).process (YOUR_CSS );
127146```
128147
@@ -142,7 +161,7 @@ var postcss = require('gulp-postcss');
142161gulp .task (' css' , function () {
143162 return gulp .src (' ./src/*.css' ).pipe (
144163 postcss ([
145- require (' postcss-logical' )()
164+ require (' postcss-logical' )(/* options */ )
146165 ])
147166 ).pipe (
148167 gulp .dest (' .' )
@@ -167,7 +186,7 @@ grunt.initConfig({
167186 postcss: {
168187 options: {
169188 use: [
170- require (' postcss-logical' )()
189+ require (' postcss-logical' )(/* options */ )
171190 ]
172191 },
173192 dist: {
@@ -187,7 +206,7 @@ grunt.initConfig({
187206[ git-img ] : https://img.shields.io/badge/chat-gitter-blue.svg
188207
189208[ PostCSS Logical Properties ] : https://github.com/jonathantneal/postcss-logical-properties
190- [ logical properties ] : https://drafts.csswg.org/css-logical/
209+ [ CSS Logical Properties and Values Level 1 ] : https://drafts.csswg.org/css-logical/
191210[ PostCSS ] : https://github.com/postcss/postcss
192211[ Gulp PostCSS ] : https://github.com/postcss/gulp-postcss
193212[ Grunt PostCSS ] : https://github.com/nDmitry/grunt-postcss
0 commit comments