Skip to content

Commit 2a77465

Browse files
committed
3.0.0
1 parent f0e23c2 commit 2a77465

19 files changed

Lines changed: 163 additions & 237 deletions

.appveyor.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.gitignore

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
node_modules
2-
index.*.js
3-
package-lock.json
4-
*.log*
5-
*.result.css
61
.*
7-
!.appveyor.yml
82
!.editorconfig
93
!.gitignore
104
!.rollup.js
115
!.tape.js
126
!.travis.yml
7+
*.log*
8+
*.result.css
9+
/index.*
10+
node_modules
11+
package-lock.json

.rollup.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import babel from 'rollup-plugin-babel';
22

33
export default {
4-
input: 'index.js',
4+
input: 'src/index.js',
55
output: [
6-
{ file: 'index.cjs.js', format: 'cjs' },
7-
{ file: 'index.es.js', format: 'es' }
6+
{ file: 'index.js', format: 'cjs', sourcemap: true, strict: false },
7+
{ file: 'index.mjs', format: 'esm', sourcemap: true, strict: false }
88
],
99
plugins: [
1010
babel({
1111
presets: [
12-
['env', { modules: false, targets: { node: 4 } }]
12+
['@babel/env', { modules: false, targets: { node: 8 } }]
1313
]
1414
})
1515
]

.tape.js

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
const postcss = require('postcss');
2+
const postcssNesting = require('postcss-nesting');
3+
const postcssExtends = require('.');
4+
15
module.exports = {
2-
'postcss-extend-rule': {
36
'basic': {
47
message: 'supports @extend usage'
58
},
@@ -23,49 +26,64 @@ module.exports = {
2326
},
2427
'advanced': {
2528
message: 'supports mixed usage (with postcss-nesting)',
26-
plugin: () => require('postcss')(
27-
require('postcss-nesting'),
28-
require('.')
29-
)
29+
plugin: postcss.plugin('postcss-extend-rule', () => {
30+
const extendsTransformer = postcssExtends();
31+
const nestingTransformer = postcssNesting();
32+
33+
return (...args) => {
34+
nestingTransformer(...args);
35+
extendsTransformer(...args);
36+
};
37+
})
3038
},
3139
'nested-media': {
3240
'message': 'supports nested @media usage'
3341
},
3442
'nested-media:nesting-first': {
3543
'message': 'supports nested @media usage when postcss-nesting runs first',
36-
plugin: () => require('postcss')(
37-
require('postcss-nesting'),
38-
require('.')
39-
)
44+
plugin: postcss.plugin('postcss-extend-rule', () => {
45+
const extendsTransformer = postcssExtends();
46+
const nestingTransformer = postcssNesting();
47+
48+
return (...args) => {
49+
nestingTransformer(...args);
50+
extendsTransformer(...args);
51+
};
52+
})
4053
},
4154
'nested-media:nesting-second': {
4255
'message': 'supports nested @medi usage when postcss-nesting runs second',
43-
plugin: () => require('postcss')(
44-
require('.'),
45-
require('postcss-nesting')
46-
)
56+
plugin: postcss.plugin('postcss-extend-rule', () => {
57+
const extendsTransformer = postcssExtends();
58+
const nestingTransformer = postcssNesting();
59+
60+
return (...args) => {
61+
extendsTransformer(...args);
62+
nestingTransformer(...args);
63+
};
64+
})
4765
},
48-
'errors': {
66+
'error': {
4967
message: 'manages error-ridden usage'
5068
},
51-
'errors:ignore': {
69+
'error:ignore': {
5270
message: 'manages error-ridden usage with { onFunctionalSelector: "ignore", onRecursiveExtend: "ignore", onUnusedExtend: "ignore" } options',
5371
options: {
5472
onFunctionalSelector: 'ignore',
5573
onRecursiveExtend: 'ignore',
5674
onUnusedExtend: 'ignore'
5775
}
5876
},
59-
'errors:warn': {
77+
'error:warn': {
6078
message: 'manages error-ridden usage with { onFunctionalSelector: "warn", onRecursiveExtend: "warn", onUnusedExtend: "warn" } options',
6179
options: {
6280
onFunctionalSelector: 'warn',
6381
onRecursiveExtend: 'warn',
6482
onUnusedExtend: 'warn'
6583
},
66-
warning: 6
84+
warnings: 2
6785
},
68-
'errors:throw': {
86+
'error:throw': {
6987
message: 'manages error-ridden usage with { onFunctionalSelector: "throw", onRecursiveExtend: "throw", onUnusedExtend: "throw" } options',
7088
options: {
7189
onFunctionalSelector: 'throw',
@@ -76,7 +94,7 @@ module.exports = {
7694
reason: 'Unused extend at-rule "some-non-existent-selector"'
7795
}
7896
},
79-
'errors:throw-on-functional-selectors': {
97+
'error:throw-on-functional-selectors': {
8098
message: 'manages error-ridden usage with { onFunctionalSelector: "throw" } options',
8199
options: {
82100
onFunctionalSelector: 'throw'
@@ -85,5 +103,4 @@ module.exports = {
85103
reason: 'Encountered functional selector "%test-placeholder"'
86104
}
87105
}
88-
}
89106
};

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
language: node_js
44

55
node_js:
6-
- 4
6+
- 8
77

88
install:
99
- npm install --ignore-scripts

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ scope and avoid unrelated commits.
2626
cd postcss-extend-rule
2727

2828
# Assign the original repo to a remote called "upstream"
29-
git remote add upstream [email protected]:jonathantneal/postcss-extend-rule.git
29+
git remote add upstream [email protected]:csstools/postcss-extend-rule.git
3030

3131
# Install the tools necessary for testing
3232
npm install

README.md

Lines changed: 16 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PostCSS Extend Rule [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]
1+
# PostCSS Extend Rule [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS" width="90" height="90" align="right">][postcss]
22

33
[![NPM Version][npm-img]][npm-url]
44
[![Build Status][cli-img]][cli-url]
@@ -57,126 +57,35 @@
5757

5858
## Usage
5959

60-
Add [PostCSS Extend Rule] to your build tool:
60+
Add [PostCSS Extend Rule] to your project:
6161

6262
```bash
6363
npm install postcss-extend-rule --save-dev
6464
```
6565

66-
#### Node
67-
68-
Use [PostCSS Extend Rule] to process your CSS:
66+
Use **PostCSS Extend Rule** to process your CSS:
6967

7068
```js
71-
import postcssExtend from 'postcss-extend-rule';
69+
const postcssExtendRule = require('postcss-extend-rule');
7270

73-
postcssExtend.process(YOUR_CSS, /* processOptions */ /*, pluginOptions */);
71+
postcssExtendRule.process(YOUR_CSS /*, processOptions, pluginOptions */);
7472
```
7573

76-
#### PostCSS
77-
78-
Add [PostCSS] to your build tool:
79-
80-
```bash
81-
npm install postcss --save-dev
82-
```
83-
84-
Use [PostCSS Extend Rule] as a plugin:
74+
Or use it as a [PostCSS] plugin:
8575

8676
```js
87-
import postcss from 'gulp-postcss';
88-
import postcssExtend from 'postcss-extend-rule';
77+
const postcss = require('postcss');
78+
const postcssExtendRule = require('postcss-extend-rule');
8979

9080
postcss([
91-
postcssExtend(/* pluginOptions */)
92-
]).process(YOUR_CSS);
93-
```
94-
95-
#### Webpack
96-
97-
Add [PostCSS Loader] to your build tool:
98-
99-
```bash
100-
npm install postcss-loader --save-dev
101-
```
102-
103-
Use [PostCSS Extend Rule] in your Webpack configuration:
104-
105-
```js
106-
import postcssExtend from 'postcss-extend-rule';
107-
108-
module.exports = {
109-
module: {
110-
rules: [
111-
{
112-
test: /\.css$/,
113-
use: [
114-
'style-loader',
115-
{ loader: 'css-loader', options: { importLoaders: 1 } },
116-
{ loader: 'postcss-loader', options: {
117-
ident: 'postcss',
118-
plugins: () => [
119-
postcssExtend(/* pluginOptions */)
120-
]
121-
} }
122-
]
123-
}
124-
]
125-
}
126-
}
81+
postcssExtendRule(/* pluginOptions */)
82+
]).process(YOUR_CSS /*, processOptions */);
12783
```
12884

129-
#### Gulp
85+
**PostCSS Extend Rule** runs in all Node environments, with special instructions for:
13086

131-
Add [Gulp PostCSS] to your build tool:
132-
133-
```bash
134-
npm install gulp-postcss --save-dev
135-
```
136-
137-
Use [PostCSS Extend Rule] in your Gulpfile:
138-
139-
```js
140-
import postcss from 'gulp-postcss';
141-
import postcssExtend from 'postcss-extend-rule';
142-
143-
gulp.task('css', () => gulp.src('./src/*.css').pipe(
144-
postcss([
145-
postcssExtend(/* pluginOptions */)
146-
])
147-
).pipe(
148-
gulp.dest('.')
149-
));
150-
```
151-
152-
#### Grunt
153-
154-
Add [Grunt PostCSS] to your build tool:
155-
156-
```bash
157-
npm install grunt-postcss --save-dev
158-
```
159-
160-
Use [PostCSS Extend Rule] in your Gruntfile:
161-
162-
```js
163-
import postcssExtend from 'postcss-extend-rule';
164-
165-
grunt.loadNpmTasks('grunt-postcss');
166-
167-
grunt.initConfig({
168-
postcss: {
169-
options: {
170-
use: [
171-
postcssExtend(/* pluginOptions */)
172-
]
173-
},
174-
dist: {
175-
src: '*.css'
176-
}
177-
}
178-
});
179-
```
87+
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
88+
| --- | --- | --- | --- | --- | --- |
18089

18190
## Options
18291

@@ -256,17 +165,14 @@ main {
256165
}
257166
```
258167

259-
[cli-img]: https://img.shields.io/travis/jonathantneal/postcss-extend-rule.svg
260-
[cli-url]: https://travis-ci.org/jonathantneal/postcss-extend-rule
168+
[cli-img]: https://img.shields.io/travis/csstools/postcss-extend-rule/master.svg
169+
[cli-url]: https://travis-ci.org/csstools/postcss-extend-rule
261170
[git-img]: https://img.shields.io/badge/support-chat-blue.svg
262171
[git-url]: https://gitter.im/postcss/postcss
263172
[npm-img]: https://img.shields.io/npm/v/postcss-extend-rule.svg
264173
[npm-url]: https://www.npmjs.com/package/postcss-extend-rule
265174

266175
[CSS Extend Rules Specification]: https://jonathantneal.github.io/specs/css-extend-rule/
267176
[Functional Selectors]: https://jonathantneal.github.io/specs/css-extend-rule/#functional-selector
268-
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
269-
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
270177
[PostCSS]: https://github.com/postcss/postcss
271-
[PostCSS Loader]: https://github.com/postcss/postcss-loader
272-
[PostCSS Extend Rule]: https://github.com/jonathantneal/postcss-extend-rule
178+
[PostCSS Extend Rule]: https://github.com/csstools/postcss-extend-rule

0 commit comments

Comments
 (0)