Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit 62c1907

Browse files
committed
4.0.0
1 parent 3cf40a4 commit 62c1907

File tree

4 files changed

+66
-30
lines changed

4 files changed

+66
-30
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changes to PostCSS Dir Pseudo Class
22

3+
### 4.0.0 (May 8, 2018)
4+
5+
- Updated: `postcss-selector-parser` to v4.0.0 (major)
6+
- Updated: `postcss` to v6.0.22 (patch)
7+
38
### 3.0.0 (March 21, 2018)
49

510
- Added: `preserve` option to preserve the original `:dir()` rule

README.md

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
[![Windows Build Status][win-img]][win-url]
77
[![Support Chat][git-img]][git-url]
88

9-
[PostCSS Dir Pseudo Class] lets you use the `:dir()` pseudo-class to style by
10-
directionality in CSS, following the [Selectors Level 4] specification.
9+
[PostCSS Dir Pseudo Class] lets you style by directionality using the `:dir()`
10+
pseudo-class in CSS, following the [Selectors] specification.
1111

12-
```css
12+
```pcss
1313
article h3:dir(rtl) {
1414
margin-right: 10px;
1515
}
@@ -29,7 +29,7 @@ article h3:dir(ltr) {
2929
}
3030
```
3131

32-
### Maintain Specificity
32+
### Maintaining Specificity
3333

3434
Using [PostCSS Dir Pseudo Class] will not impact selector weight, but it will
3535
require having at least one `[dir]` attribute in your HTML. If you don’t have
@@ -60,7 +60,7 @@ Use [PostCSS Dir Pseudo Class] to process your CSS:
6060
```js
6161
import postcssDirPseudoClass from 'postcss-dir-pseudo-class';
6262

63-
postcssDirPseudoClass.process(YOUR_CSS);
63+
postcssDirPseudoClass.process(YOUR_CSS, /* processOptions */, /* pluginOptions */);
6464
```
6565

6666
#### PostCSS
@@ -78,7 +78,7 @@ import postcss from 'gulp-postcss';
7878
import postcssDirPseudoClass from 'postcss-dir-pseudo-class';
7979

8080
postcss([
81-
postcssDirPseudoClass()
81+
postcssDirPseudoClass(/* pluginOptions */)
8282
]).process(YOUR_CSS);
8383
```
8484

@@ -106,7 +106,7 @@ module.exports = {
106106
{ loader: 'postcss-loader', options: {
107107
ident: 'postcss',
108108
plugins: () => [
109-
postcssDirPseudoClass(/* options */)
109+
postcssDirPseudoClass(/* pluginOptions */)
110110
]
111111
} }
112112
]
@@ -132,7 +132,7 @@ import postcssDirPseudoClass from 'postcss-dir-pseudo-class';
132132

133133
gulp.task('css', () => gulp.src('./src/*.css').pipe(
134134
postcss([
135-
postcssDirPseudoClass(/* options */)
135+
postcssDirPseudoClass(/* pluginOptions */)
136136
])
137137
).pipe(
138138
gulp.dest('.')
@@ -158,7 +158,7 @@ grunt.initConfig({
158158
postcss: {
159159
options: {
160160
use: [
161-
postcssDirPseudoClass(/* options */)
161+
postcssDirPseudoClass(/* pluginOptions */)
162162
]
163163
},
164164
dist: {
@@ -180,12 +180,10 @@ Here’s an example of using the `dir` option to presume a left-to-right
180180
direction:
181181

182182
```js
183-
require('postcss-dir-pseudo-class')({
184-
dir: 'ltr'
185-
});
183+
postcssDirPseudoClass({ dir: 'ltr' });
186184
```
187185

188-
```css
186+
```pcss
189187
.example:dir(ltr) {
190188
margin-left: 10px;
191189
}
@@ -208,22 +206,54 @@ html:not([dir="rtl"]) .example {
208206
### preserve
209207

210208
The `preserve` option determines whether the original `:dir()` rule should
211-
remain in the CSS. By default, the rule is replaced by the fallback.
209+
remain in the CSS. By default, the original rule is not preserved.
210+
211+
```js
212+
postcssDirPseudoClass({ preserve: true });
213+
```
214+
215+
```pcss
216+
article h3:dir(rtl) {
217+
margin-right: 10px;
218+
}
219+
220+
article h3:dir(ltr) {
221+
margin-left: 10px;
222+
}
223+
224+
/* becomes */
225+
226+
[dir="rtl"] article h3 {
227+
margin-right: 10px;
228+
}
229+
230+
article h3:dir(rtl) {
231+
margin-right: 10px;
232+
}
233+
234+
[dir="ltr"] article h3 {
235+
margin-left: 10px;
236+
}
237+
238+
article h3:dir(ltr) {
239+
margin-left: 10px;
240+
}
241+
```
212242

213-
[cli-url]: https://travis-ci.org/jonathantneal/postcss-dir-pseudo-class
214243
[cli-img]: https://img.shields.io/travis/jonathantneal/postcss-dir-pseudo-class.svg
244+
[cli-url]: https://travis-ci.org/jonathantneal/postcss-dir-pseudo-class
215245
[css-img]: https://jonathantneal.github.io/cssdb/badge/dir-pseudo-class.svg
216246
[css-url]: https://jonathantneal.github.io/cssdb/#dir-pseudo-class
217-
[git-url]: https://gitter.im/postcss/postcss
218247
[git-img]: https://img.shields.io/badge/support-chat-blue.svg
219-
[npm-url]: https://www.npmjs.com/package/postcss-dir-pseudo-class
248+
[git-url]: https://gitter.im/postcss/postcss
220249
[npm-img]: https://img.shields.io/npm/v/postcss-dir-pseudo-class.svg
221-
[win-url]: https://ci.appveyor.com/project/jonathantneal/postcss-dir-pseudo-class
250+
[npm-url]: https://www.npmjs.com/package/postcss-dir-pseudo-class
222251
[win-img]: https://img.shields.io/appveyor/ci/jonathantneal/postcss-dir-pseudo-class.svg
252+
[win-url]: https://ci.appveyor.com/project/jonathantneal/postcss-dir-pseudo-class
223253

224254
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
225255
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
226256
[PostCSS]: https://github.com/postcss/postcss
227-
[PostCSS Dir Pseudo Class]: https://github.com/jonathantneal/postcss-dir-pseudo-class
228257
[PostCSS Loader]: https://github.com/postcss/postcss-loader
229-
[Selectors Level 4]: https://www.w3.org/TR/selectors-4/
258+
[PostCSS Dir Pseudo Class]: https://github.com/jonathantneal/postcss-dir-pseudo-class
259+
[Selectors]: https://www.w3.org/TR/selectors-4/#the-dir-pseudo

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export default postcss.plugin('postcss-dir-pseudo-class', opts => {
6262
const dirAttr = selectorParser.attribute({
6363
attribute: 'dir',
6464
operator: '=',
65+
quoteMark: '"',
6566
value: `"${ value }"`
6667
});
6768

@@ -74,6 +75,7 @@ export default postcss.plugin('postcss-dir-pseudo-class', opts => {
7475
selectorParser.attribute({
7576
attribute: 'dir',
7677
operator: '=',
78+
quoteMark: '"',
7779
value: `"${ 'ltr' === value ? 'rtl' : 'ltr' }"`
7880
})
7981
);

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-dir-pseudo-class",
3-
"version": "3.0.0",
3+
"version": "4.0.0",
44
"description": "Use the :dir pseudo-class in CSS",
55
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
66
"license": "CC0-1.0",
@@ -16,7 +16,7 @@
1616
"scripts": {
1717
"prepublishOnly": "npm test",
1818
"pretest": "rollup -c .rollup.js --silent",
19-
"test": "echo 'Running tests...'; npm run test:ec && npm run test:js && npm run test:tape",
19+
"test": "echo 'Running tests...'; npm run test:js && npm run test:tape",
2020
"test:ec": "echint --ignore index.*.js test",
2121
"test:js": "eslint *.js --cache --ignore-path .gitignore --quiet",
2222
"test:tape": "postcss-tape"
@@ -25,20 +25,19 @@
2525
"node": ">=4.0.0"
2626
},
2727
"dependencies": {
28-
"postcss": "^6.0.20",
29-
"postcss-selector-parser": "^3.1.1"
28+
"postcss": "^6.0.22",
29+
"postcss-selector-parser": "^4.0.0"
3030
},
3131
"devDependencies": {
32-
"babel-core": "^6.26.0",
33-
"babel-eslint": "^8.2.2",
32+
"babel-core": "^6.26.3",
33+
"babel-eslint": "^8.2.3",
3434
"babel-preset-env": "^1.6.1",
35-
"echint": "^4.0.1",
36-
"eslint": "^4.19.0",
35+
"eslint": "^4.19.1",
3736
"eslint-config-dev": "^2.0.0",
3837
"postcss-tape": "^2.2.0",
3938
"pre-commit": "^1.2.2",
40-
"rollup": "^0.57.1",
41-
"rollup-plugin-babel": "^3.0.3"
39+
"rollup": "^0.58.2",
40+
"rollup-plugin-babel": "^3.0.4"
4241
},
4342
"eslintConfig": {
4443
"extends": "dev",

0 commit comments

Comments
 (0)