MCPcopy Create free account
hub / github.com/cuth/postcss-pxtorem / Once

Function Once

index.js:128–150  ·  view source on GitHub ↗
(css)

Source from the content-addressed store, hash-verified

126 return {
127 postcssPlugin: "postcss-pxtorem",
128 Once(css) {
129 const filePath = css.source.input.file;
130 if (
131 exclude &&
132 ((type.isFunction(exclude) && exclude(filePath)) ||
133 (type.isString(exclude) && filePath.indexOf(exclude) !== -1) ||
134 filePath.match(exclude) !== null)
135 ) {
136 isExcludeFile = true;
137 } else {
138 isExcludeFile = false;
139 }
140
141 const rootValue =
142 typeof opts.rootValue === "function"
143 ? opts.rootValue(css.source.input)
144 : opts.rootValue;
145 pxReplace = createPxReplace(
146 rootValue,
147 opts.unitPrecision,
148 opts.minPixelValue
149 );
150 },
151 Declaration(decl) {
152 if (isExcludeFile) return;
153

Callers

nothing calls this directly

Calls 1

createPxReplaceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…