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

fix(cli): Preflight not working with CLI, close #514 #673

Merged
merged 1 commit into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ export class Processor {
this._handler = createHandler(this._config.handlers);
this._config.shortcuts && this.loadShortcuts(this._config.shortcuts);
this._config.alias && this.loadAlias(this._config.alias);

if (this._config.preflight && this._config.preflight.safelist) {
if (typeof this._config.preflight.safelist === 'string') {
this._config.preflight.safelist = this._config.preflight.safelist.split(/\s+/);
}
}
}

private _resolveConfig(userConfig: Config, presets: Config = {}) {
Expand Down
3 changes: 2 additions & 1 deletion src/lib/preflight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export default function preflight(
return style;
};

const tags = html ? Array.from(new Set(html.match(/<\w+/g))).map((i) => i.substring(1)) : undefined;
const safelist = processor.config('preflight.safelist', []) as string[];
const tags = html ? safelist.concat(Array.from(new Set(html.match(/<\w+/g))).map((i) => i.substring(1))) : undefined;

// handle base style
includeBase && (processor.config('prefixer') ? baseUtilities : baseUtilities.filter(i => !i.selector || !/::?(webkit-input|-moz|-ms-input)-placeholder$/.test(i.selector))).forEach(p => {
Expand Down