Skip to content

Conversation

@ryelle
Copy link
Collaborator

@ryelle ryelle commented Dec 3, 2020

Update the report result from each audit to be an object, instead of an array of arrays. This way, we can set some meta properties on each report, and avoid tying the HTML templates to the audits so tightly.

{
	name: 'Selectors',
	template: 'selectors',
	results: [],
}

This will now use the report.name in each section's <h2>. If template is set (it's optional), the corresponding file in templates/audits/ will be used to render this section. We can also re-use audit templates if the same layout will work for other audits, for example the display-none audit and selectors audit can both use the "selectors" template, since they both display a selector/file combo.

To test:

Run the audits. Replace test.css with your local test file(s).

CLI

npm run css-audit -- test.css --all --property-values=letter-spacing 

JSON

npm run css-audit -- test.css --all --property-values=letter-spacing --format=json

HTML

npm run css-audit -- test.css --all --property-values=letter-spacing --format=html --filename=test

@ryelle ryelle self-assigned this Dec 3, 2020
@ryelle
Copy link
Collaborator Author

ryelle commented Dec 3, 2020

Now that #11's been merged, the templates changed - so I'll update this to fix the conflicts.

@ryelle ryelle force-pushed the update/audit-result-format branch from dcb5ec7 to 529dba4 Compare December 9, 2020 03:27
@ryelle ryelle merged commit 5b6ecbd into master Dec 15, 2020
@ryelle ryelle deleted the update/audit-result-format branch December 15, 2020 21:49
@ryelle ryelle mentioned this pull request Dec 16, 2020
@ryelle ryelle mentioned this pull request Jan 7, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants