@fullhuman/postcss-purgecss
- Version 7.0.2
- Published
- 17.7 kB
- 1 dependency
- MIT license
Install
npm i @fullhuman/postcss-purgecss
yarn add @fullhuman/postcss-purgecss
pnpm add @fullhuman/postcss-purgecss
Overview
PostCSS Plugin for PurgeCSS
Most bundlers and frameworks to build websites are using PostCSS. The easiest way to configure PurgeCSS is with its PostCSS plugin.
Index
Variables
Interfaces
Type Aliases
Variables
variable purgeCSSPlugin
const purgeCSSPlugin: postcss.PluginCreator<UserDefinedOptions>;
PostCSS Plugin for PurgeCSS
Parameter opts
PurgeCSS Options
Returns
the postCSS plugin
Modifiers
@public
Interfaces
interface ExtractorResultDetailed
interface ExtractorResultDetailed {}
Modifiers
@public
property attributes
attributes: { names: string[]; values: string[];};
property classes
classes: string[];
property ids
ids: string[];
property tags
tags: string[];
property undetermined
undetermined: string[];
interface Extractors
interface Extractors {}
Modifiers
@public
property extensions
extensions: string[];
property extractor
extractor: ExtractorFunction;
interface PurgeCSSUserDefinedOptions
interface PurgeCSSUserDefinedOptions {}
Options used by PurgeCSS to remove unused CSS
Modifiers
@public
property blocklist
blocklist?: StringRegExpArray;
See documentation for Options.blocklist from package purgecss.
property content
content: Array<string | RawContent>;
See documentation for Options.content from package purgecss.
property css
css: Array<string | RawCSS>;
See documentation for Options.css from package purgecss.
property defaultExtractor
defaultExtractor?: ExtractorFunction;
See documentation for Options.defaultExtractor from package purgecss.
property dynamicAttributes
dynamicAttributes?: string[];
See documentation for Options.dynamicAttributes from package purgecss.
property extractors
extractors?: Array<Extractors>;
See documentation for Options.extractors from package purgecss.
property fontFace
fontFace?: boolean;
See documentation for Options.fontFace from package purgecss.
property keyframes
keyframes?: boolean;
See documentation for Options.keyframes from package purgecss.
property output
output?: string;
See documentation for Options.output from package purgecss.
property rejected
rejected?: boolean;
See documentation for Options.rejected from package purgecss.
property rejectedCss
rejectedCss?: boolean;
See documentation for Options.rejectedCss from package purgecss.
property safelist
safelist?: UserDefinedSafelist;
See documentation for Options.safelist from package purgecss.
property skippedContentGlobs
skippedContentGlobs?: Array<string>;
See documentation for Options.skippedContentGlobs from package purgecss.
property sourceMap
sourceMap?: boolean | (postcss.SourceMapOptions & { to?: string });
See documentation for Options.sourceMap from package purgecss.
property stdin
stdin?: boolean;
See documentation for Options.stdin from package purgecss.
property stdout
stdout?: boolean;
See documentation for Options.stdout from package purgecss.
property variables
variables?: boolean;
See documentation for Options.variables from package purgecss.
interface RawContent
interface RawContent<T = string> {}
Modifiers
@public
interface RawCSS
interface RawCSS {}
Modifiers
@public
interface UserDefinedOptions
interface UserDefinedOptions extends Omit<PurgeCSSUserDefinedOptions, 'content' | 'css'> {}
See documentation for UserDefinedOptions from package purgecss.
property content
content?: PurgeCSSUserDefinedOptions['content'];
property contentFunction
contentFunction?: (sourceFile: string) => Array<string | RawContent>;
Type Aliases
type ComplexSafelist
type ComplexSafelist = { standard?: StringRegExpArray; /** * You can safelist selectors and their children based on a regular * expression with `safelist.deep` * * @example * * ```ts * const purgecss = await new PurgeCSS().purge({ * content: [], * css: [], * safelist: { * deep: [/red$/] * } * }) * ``` * * In this example, selectors such as `.bg-red .child-of-bg` will be left * in the final CSS, even if `child-of-bg` is not found. * */ deep?: RegExp[]; greedy?: RegExp[]; variables?: StringRegExpArray; keyframes?: StringRegExpArray;};
Modifiers
@public
type ExtractorFunction
type ExtractorFunction<T = string> = (content: T) => ExtractorResult;
Modifiers
@public
type ExtractorResult
type ExtractorResult = ExtractorResultDetailed | string[];
Modifiers
@public
type StringRegExpArray
type StringRegExpArray = Array<RegExp | string>;
Modifiers
@public
type UserDefinedSafelist
type UserDefinedSafelist = StringRegExpArray | ComplexSafelist;
Modifiers
@public
Package Files (1)
Dependencies (1)
Dev Dependencies (1)
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@fullhuman/postcss-purgecss
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@fullhuman/postcss-purgecss)
- HTML<a href="https://www.jsdocs.io/package/@fullhuman/postcss-purgecss"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3161 ms. - Missing or incorrect documentation? Open an issue for this package.