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

Use a config file to configure audit options #8

Closed
ryelle opened this issue Oct 11, 2020 · 0 comments · Fixed by #9
Closed

Use a config file to configure audit options #8

ryelle opened this issue Oct 11, 2020 · 0 comments · Fixed by #9
Labels
enhancement New feature or request

Comments

@ryelle
Copy link
Collaborator

ryelle commented Oct 11, 2020

This came out of discussion around #7, but is a larger idea, hence new issue. The arguments we can pass via CLI are pretty long and generally not very clear. Instead, what if we had a config file (akin to webpack.config.js/eslintrc.js) to set up those rules? It could be a JS/JSON file that describes the desired report (format, audits, etc).

I'm thinking something like this for format, which kind of follows a babel-ish pattern for audits, where you can say the string name of the audit, or an array with the first item as the name, and second as arguments to the audit. This would also address the issue in #7 by allowing for repeating audits with different arguments.

Example:

{
	"format": "html",
	"filename": "wp-admin",
	"audits": [
		"colors",
		"important",
		"display-none",
		"selectors",
		"media-queries",
		[
			"property-values",
			{
				"options": [ "font-size" ]
			}
		],
		[
			"property-values",
			{
				"options": [
					"padding-top",
					"padding-bottom",
					"padding-left",
					"padding-right"
				]
			}
		]
	]
}

We could also allow for a simple file like this— though maybe we should rename all & recommended to preset:all & preset:recommended.

{
	"format": "cli-table",
	"audits": "recommended"
}
@ryelle ryelle added the enhancement New feature or request label Oct 11, 2020
@ryelle ryelle closed this as completed in #9 Jan 21, 2021
ryelle added a commit that referenced this issue Jan 21, 2021
- Adds the ability to store audit arguments in a configuration file named css-audit.config.js in the root of the project, fixes #8
- Supports multiple property-values audits from the config

Co-authored-by: Kelly Dwan <ryelle@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant