@@ -60,7 +60,11 @@ var defaults = {
60
60
preserveInjectedVariables : true ,
61
61
// Will write media queries in the same order as in the original file.
62
62
// Currently defaulted to false for legacy behavior. We can update to `true` in a major version
63
- preserveAtRulesOrder : false
63
+ preserveAtRulesOrder : false ,
64
+
65
+ includePaths : [ ] ,
66
+
67
+ silent : false ,
64
68
} ;
65
69
66
70
module . exports = ( options = { } ) => {
@@ -72,7 +76,13 @@ module.exports = (options = {}) => {
72
76
postcssPlugin : 'postcss-css-variables' ,
73
77
Once ( css , { decl, result, rule } ) {
74
78
// Transform CSS AST here
79
+
80
+ const filename = css . source . input . file
75
81
82
+ if ( opts . includePaths . length ) {
83
+ const matches = opts . includePaths . some ( path => filename . includes ( path ) )
84
+ if ( ! matches ) return
85
+ }
76
86
/* * /
77
87
try {
78
88
/* */
@@ -141,6 +151,9 @@ module.exports = (options = {}) => {
141
151
// Chainable helper function to log any messages (warnings)
142
152
var logResolveValueResult = function ( valueResult ) {
143
153
// Log any warnings that might of popped up
154
+
155
+ if ( opts . silent ) return valueResult ;
156
+
144
157
var warningList = [ ] . concat ( valueResult . warnings ) ;
145
158
warningList . forEach ( function ( warningArgs ) {
146
159
warningArgs = [ ] . concat ( warningArgs ) ;
@@ -158,7 +171,7 @@ module.exports = (options = {}) => {
158
171
eachCssVariableDeclaration ( css , function ( decl ) {
159
172
var declParentRule = decl . parent ;
160
173
161
- var valueResults = logResolveValueResult ( resolveValue ( decl , map ) ) ;
174
+ var valueResults = logResolveValueResult ( resolveValue ( decl , map , undefined , undefined ) ) ;
162
175
// Split out each selector piece into its own declaration for easier logic down the road
163
176
decl . parent . selectors . forEach ( function ( selector ) {
164
177
// Create a detached clone
0 commit comments