@liip/class-prefixer-core
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

class-prefixer-core

Core utilities of the class-prefixer packages.

prefixer

The actual string prefixing implementation

function prefixer(value: string, options?: PrefixerOptions): string;

options

type PrefixerOptions = {
  prefix?: PrefixOptions;
  container?: ContainerOptions;
};

prefix

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.

container

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)[];

classExpressionPrefixer

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;

selectorPrefixer

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;

Package Sidebar

Install

npm i @liip/class-prefixer-core

Weekly Downloads

79

Version

0.3.0

License

MIT

Unpacked Size

15.6 kB

Total Files

15

Last publish

Collaborators

  • lgollut