|
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] |
2 | 2 |
|
3 | 3 | [![NPM Version][npm-img]][npm-url] |
4 | 4 | [![Build Status][cli-img]][cli-url] |
|
57 | 57 |
|
58 | 58 | ## Usage |
59 | 59 |
|
60 | | -Add [PostCSS Extend Rule] to your build tool: |
| 60 | +Add [PostCSS Extend Rule] to your project: |
61 | 61 |
|
62 | 62 | ```bash |
63 | 63 | npm install postcss-extend-rule --save-dev |
64 | 64 | ``` |
65 | 65 |
|
66 | | -#### Node |
67 | | - |
68 | | -Use [PostCSS Extend Rule] to process your CSS: |
| 66 | +Use **PostCSS Extend Rule** to process your CSS: |
69 | 67 |
|
70 | 68 | ```js |
71 | | -import postcssExtend from 'postcss-extend-rule'; |
| 69 | +const postcssExtendRule = require('postcss-extend-rule'); |
72 | 70 |
|
73 | | -postcssExtend.process(YOUR_CSS, /* processOptions */ /*, pluginOptions */); |
| 71 | +postcssExtendRule.process(YOUR_CSS /*, processOptions, pluginOptions */); |
74 | 72 | ``` |
75 | 73 |
|
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: |
85 | 75 |
|
86 | 76 | ```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'); |
89 | 79 |
|
90 | 80 | 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 */); |
127 | 83 | ``` |
128 | 84 |
|
129 | | -#### Gulp |
| 85 | +**PostCSS Extend Rule** runs in all Node environments, with special instructions for: |
130 | 86 |
|
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 | +| --- | --- | --- | --- | --- | --- | |
180 | 89 |
|
181 | 90 | ## Options |
182 | 91 |
|
@@ -256,17 +165,14 @@ main { |
256 | 165 | } |
257 | 166 | ``` |
258 | 167 |
|
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 |
261 | 170 | [git-img]: https://img.shields.io/badge/support-chat-blue.svg |
262 | 171 | [git-url]: https://gitter.im/postcss/postcss |
263 | 172 | [npm-img]: https://img.shields.io/npm/v/postcss-extend-rule.svg |
264 | 173 | [npm-url]: https://www.npmjs.com/package/postcss-extend-rule |
265 | 174 |
|
266 | 175 | [CSS Extend Rules Specification]: https://jonathantneal.github.io/specs/css-extend-rule/ |
267 | 176 | [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 |
270 | 177 | [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