Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Latest
method default.prototype.replaceValues
import { default } from "https://deno.land/x/postcss@8.4.16/lib/container.js";

Passes all declaration values within the container that match pattern through callback, replacing those values with the returned result of callback.

This method is useful if you are using a custom unit or function and need to iterate through all values.

root.replaceValues(/\d+rem/, { fast: 'rem' }, string => {
  return 15 * parseInt(string) + 'px'
})

Parameters

pattern: string | RegExp

Replace pattern.

options: ValueOptions

Options to speed up the search.

replaced: string | { (substring: string, ...args: any[]): string; }

String to replace pattern or callback that returns a new value. The callback will receive the same arguments as those passed to a function parameter of String#replace.

Returns

this

This node for methods chain.

Parameters

pattern: string | RegExp
replaced: string | { (substring: string, ...args: any[]): string; }