UNPKG

postcss-rename

Version:

A PostCSS plugin to replace class names based on a customizable renaming scheme.

41 lines (40 loc) 1.53 kB
/** * @license * Copyright 2020 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns the next unique short string whose first character is in * `START_CHARS` and whose subsequent characters, if any, are in `CHARS`. * * This is public so it can be unit-tested. */ export declare function toShortName(index: number): string; /** Renames CSS names to the smallest valid identifiers. */ export declare class MinimalRenamer { private readonly skip; /** The next index to pass to `toShortName()`. */ private nextIndex; /** A map from original CSS names to their renamed equivalents. */ private readonly renames; /** * Creates a new MinimalSubstitutionMap that generates CSS names from the * specified set of characters. * * @param skip A function which decides if given CSS names may not be * returned as the output from a substitution lookup. */ constructor(skip: (nodeValue: string) => boolean); rename(key: string): string; }