Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/bundler/deps.ts>postcss.Container#replaceValues

A Bundler with the web in mind.
Go to Latest
method postcss.Container.prototype.replaceValues
Re-export
import { postcss } from "https://deno.land/x/bundler@0.6.5/deps.ts";
const { Container } = postcss;

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; }