11# Installing PostCSS Browser Comments
22
3- [ PostCSS Browser Comments] runs in all Node environments, with special instructions for:
3+ [ PostCSS Browser Comments] runs in all Node environments, with special
4+ instructions for:
45
5- | [ Node] ( #node ) | [ Webpack] ( #webpack ) | [ Create React App] ( #create-react-app ) | [ Gulp] ( #gulp ) | [ Grunt] ( #grunt ) |
6- | --- | --- | --- | --- | --- |
6+ | [ Node] ( #node ) | [ PostCSS CLI ] ( #postcss-cli ) | [ Webpack] ( #webpack ) | [ Create React App] ( #create-react-app ) | [ Gulp] ( #gulp ) | [ Grunt] ( #grunt ) |
7+ | --- | --- | --- | --- | --- | --- |
78
89## Node
910
@@ -16,22 +17,42 @@ npm install postcss-browser-comments --save-dev
1617Use [ PostCSS Browser Comments] to process your CSS:
1718
1819``` js
19- import postcssBrowserComments from ' postcss-browser-comments' ;
20+ const postcssBrowserComments = require ( ' postcss-browser-comments' ) ;
2021
2122postcssBrowserComments .process (YOUR_CSS /* , processOptions, pluginOptions */ );
2223```
2324
2425Or use it as a [ PostCSS] plugin:
2526
2627``` js
27- import postcss from ' postcss' ;
28- import postcssBrowserComments from ' postcss-browser-comments' ;
28+ const postcss = require ( ' postcss' ) ;
29+ const postcssBrowserComments = require ( ' postcss-browser-comments' ) ;
2930
3031postcss ([
3132 postcssBrowserComments (/* pluginOptions */ )
3233]).process (YOUR_CSS /* , processOptions */ );
3334```
3435
36+ ## PostCSS CLI
37+
38+ Add [ PostCSS CLI] to your project:
39+
40+ ``` bash
41+ npm install postcss-cli --save-dev
42+ ```
43+
44+ Use [ PostCSS Browser Comments] in your ` postcss.config.js ` configuration file:
45+
46+ ``` js
47+ const postcssBrowserComments = require (' postcss-browser-comments' );
48+
49+ module .exports = {
50+ plugins: [
51+ postcssBrowserComments (/* pluginOptions */ )
52+ ]
53+ }
54+ ```
55+
3556## Webpack
3657
3758Add [ PostCSS Loader] to your project:
@@ -43,7 +64,7 @@ npm install postcss-loader --save-dev
4364Use [ PostCSS Browser Comments] in your Webpack configuration:
4465
4566``` js
46- import postcssBrowserComments from ' postcss-browser-comments' ;
67+ const postcssBrowserComments = require ( ' postcss-browser-comments' ) ;
4768
4869module .exports = {
4970 module: {
@@ -78,8 +99,8 @@ Use [React App Rewire PostCSS] and [PostCSS Browser Comments] in your
7899` config-overrides.js ` file:
79100
80101``` js
81- import reactAppRewirePostcss from ' react-app-rewire-postcss' ;
82- import postcssBrowserComments from ' postcss-browser-comments' ;
102+ const reactAppRewirePostcss = require ( ' react-app-rewire-postcss' ) ;
103+ const postcssBrowserComments = require ( ' postcss-browser-comments' ) ;
83104
84105export default config => reactAppRewirePostcss (config, {
85106 plugins : () => [
@@ -99,8 +120,8 @@ npm install gulp-postcss --save-dev
99120Use [ PostCSS Browser Comments] in your Gulpfile:
100121
101122``` js
102- import postcss from ' gulp-postcss' ;
103- import postcssBrowserComments from ' postcss-browser-comments' ;
123+ const postcss = require ( ' gulp-postcss' ) ;
124+ const postcssBrowserComments = require ( ' postcss-browser-comments' ) ;
104125
105126gulp .task (' css' , () => gulp .src (' ./src/*.css' ).pipe (
106127 postcss ([
@@ -122,7 +143,7 @@ npm install grunt-postcss --save-dev
122143Use [ PostCSS Browser Comments] in your Gruntfile:
123144
124145``` js
125- import postcssBrowserComments from ' postcss-browser-comments' ;
146+ const postcssBrowserComments = require ( ' postcss-browser-comments' ) ;
126147
127148grunt .loadNpmTasks (' grunt-postcss' );
128149
@@ -143,7 +164,8 @@ grunt.initConfig({
143164[ Gulp PostCSS ] : https://github.com/postcss/gulp-postcss
144165[ Grunt PostCSS ] : https://github.com/nDmitry/grunt-postcss
145166[ PostCSS ] : https://github.com/postcss/postcss
146- [ PostCSS Loader ] : https://github.com/postcss/postcss-loader
147167[ PostCSS Browser Comments ] : https://github.com/csstools/postcss-browser-comments
168+ [ PostCSS CLI ] : https://github.com/postcss/postcss-cli
169+ [ PostCSS Loader ] : https://github.com/postcss/postcss-loader
148170[ React App Rewire PostCSS ] : https://github.com/csstools/react-app-rewire-postcss
149171[ React App Rewired ] : https://github.com/timarney/react-app-rewired
0 commit comments