Core utilities of the class-prefixer
packages.
The actual string prefixing implementation
function prefixer(value: string, options?: PrefixerOptions): string;
type PrefixerOptions = {
prefix?: PrefixOptions;
container?: ContainerOptions;
};
Define the class prefix options
type PrefixOptions = {
value: string;
excludes?: TestConditions;
};
type TestConditions = (string | RegExp)[];
value
Define the actual string used to prefix classes
excludes
Strings or regular expressions to exclude certain classes from the transformation.
Define containerization options
type ContainerOptions = {
value: string;
excludes?: ContainerExcludes;
preserveRoots?: ContainerPreserveRoots;
};
type ContainerExcludes = {
element?: TestConditions | undefined;
'pseudo-class'?: TestConditions | undefined;
attribute?: TestConditions | undefined;
};
type ContainerPreserveRoots = {
element?: TestConditions | undefined;
'pseudo-class'?: TestConditions | undefined;
attribute?: TestConditions | undefined;
};
type TestConditions = (string | RegExp)[];
An helper function used to parse and prefix class names. It accept either a string, an object or an array. This can be used as a standalone alternative to prefix classes at runtime in environments that do not depend on a build chain.
type ClassValue = string | Record<string, any> | ClassValue[];
function classExpressionPrefixer(
classes: ClassValue,
options?: PrefixerOptions,
): ClassValue;
An helper function used to parse and prefix css
selectors. This can be used as a standalone alternative to prefix selectors at runtime in environments that do not depend on a build chain.
function selectorPrefixer(value: string, options?: PrefixerOptions): string;