11/**
22 * Modules dependencies
33 */
4- var Postcss = require ( "postcss" )
4+ var postcss = require ( "postcss" )
55var assign = require ( "object-assign" )
66var caniuse = require ( "caniuse-api" )
77
@@ -31,7 +31,7 @@ var caniuseFeaturesMap = {
3131 // autoprefixer: [null] // will always be null since autoprefixer does the same game as we do
3232}
3333
34- var features = {
34+ var libraryFeatures = {
3535 // Reminder: order is important
3636 customProperties : function ( options ) { return require ( "postcss-custom-properties" ) ( options ) } ,
3737 calc : function ( options ) { return require ( "postcss-calc" ) ( options ) } ,
@@ -50,7 +50,7 @@ var features = {
5050 pseudoClassMatches : function ( options ) { return require ( "postcss-selector-matches" ) ( options ) } ,
5151 pseudoClassNot : function ( options ) { return require ( "postcss-selector-not" ) ( options ) } ,
5252 colorRgba : function ( options ) { return require ( "postcss-color-rgba-fallback" ) ( options ) } ,
53- autoprefixer : function ( options ) { return require ( "autoprefixer-core" ) ( options ) . postcss }
53+ autoprefixer : function ( options ) { return require ( "autoprefixer-core" ) ( options ) . postcss } ,
5454}
5555
5656/**
@@ -98,19 +98,19 @@ function cssnext(string, options) {
9898 if ( features . autoprefixer . browsers === undefined ) { delete features . autoprefixer . browsers }
9999 }
100100
101- var postcss = Postcss ( )
101+ var postcssInstance = postcss ( )
102102
103103 // only enable import & url if fs module is available
104104 var fs = require ( "fs" )
105105 if ( fs && fs . readFile ) {
106106 // @import
107107 if ( options . import !== false ) {
108- postcss . use ( require ( "postcss-import" ) ( typeof options . import === "object" ? options . import : undefined ) )
108+ postcssInstance . use ( require ( "postcss-import" ) ( typeof options . import === "object" ? options . import : undefined ) )
109109 }
110110
111111 // url() adjustements
112112 if ( options . url !== false ) {
113- postcss . use ( require ( "postcss-url" ) ( typeof options . url === "object" ? options . url : undefined ) )
113+ postcssInstance . use ( require ( "postcss-url" ) ( typeof options . url === "object" ? options . url : undefined ) )
114114 }
115115 }
116116
@@ -135,19 +135,19 @@ function cssnext(string, options) {
135135 )
136136 )
137137 ) {
138- postcss . use ( cssnext . features [ key ] ( typeof features [ key ] === "object" ? features [ key ] : undefined ) )
138+ postcssInstance . use ( cssnext . features [ key ] ( typeof features [ key ] === "object" ? features [ key ] : undefined ) )
139139 }
140140 } )
141141
142142 // minification
143143 if ( options . compress ) {
144144 var csswring = require ( "csswring" )
145- postcss . use ( typeof options . compress === "object" ? csswring ( options . compress ) : csswring )
145+ postcssInstance . use ( typeof options . compress === "object" ? csswring ( options . compress ) : csswring )
146146 }
147147
148148 // classic API if string is passed
149149 if ( typeof string === "string" ) {
150- var result = postcss . process ( string , options )
150+ var result = postcssInstance . process ( string , options )
151151
152152 // default behavior, cssnext returns a css string if no or inline sourcemap
153153 if ( options . map === null || ( options . map === true || options . map . inline ) ) {
@@ -159,7 +159,7 @@ function cssnext(string, options) {
159159 }
160160 // or return the postcss instance that can be consumed as a postcss plugin
161161 else {
162- return postcss
162+ return postcssInstance
163163 }
164164}
165165
@@ -168,4 +168,4 @@ function cssnext(string, options) {
168168 *
169169 * @type {Object }
170170 */
171- cssnext . features = features
171+ cssnext . features = libraryFeatures
0 commit comments