Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: property allowRules #150

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/critters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module.exports = {
+ new Critters({
+ // optional configuration
+ preload: 'swap',
+ includeSelectors: [/^\.btn/, '.banner'],
+ allowRules: [/^\.btn/, '.banner'],
+ })
]
}
Expand Down Expand Up @@ -116,7 +116,7 @@ All optional. Pass them to `new Critters({ ... })`.
- `compress` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Compress resulting critical CSS _(default: `true`)_
- `logLevel` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Controls [log level](#loglevel) of the plugin _(default: `"info"`)_
- `logger` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Provide a custom logger interface [logger](#logger)
- `includeSelectors` **[RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)** | **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Provide a list of selectors that should be included in the critical CSS. Accepts both RegExp and string.
- `allowRules` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)** | **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** Provide a list of selectors that should be included in the critical CSS. Accepts both RegExp and string.

### Include/exclude rules

Expand Down
1 change: 1 addition & 0 deletions packages/critters/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface Options {
logLevel?: 'info' | 'warn' | 'error' | 'trace' | 'debug' | 'silent';
reduceInlineStyles?: boolean;
logger?: Logger;
allowRules?: (string | RegExp)[]
}

export interface Logger {
Expand Down
1 change: 1 addition & 0 deletions packages/critters/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ import { createLogger } from './util';
* @property {Boolean} compress Compress resulting critical CSS _(default: `true`)_
* @property {String} logLevel Controls {@link LogLevel log level} of the plugin _(default: `"info"`)_
* @property {object} logger Provide a custom logger interface {@link Logger logger}
* @property {(String|RegExp)[]} allowRules Provide a list of selectors that should be included in the critical CSS. Accepts both RegExp and string.
*/

export default class Critters {
Expand Down