A CSS linting and analysis tool with pluggable strategies for scanning and reporting on CSS class usage patterns.
- Pluggable Strategies: Analyze different CSS frameworks (Tailwind, Bootstrap, custom, etc.)
- Detailed Reporting: Get statistics on class usage, categorization, and patterns
- JSON Export: Export analysis results for aggregation and tracking over time
- File Context: See where classes are used with line numbers and context
Add css_linter to your list of dependencies in mix.exs:
def deps do
[
{:css_linter, github: "vintrepid/css_linter", branch: "master"}
]
endmix css_linter.analyze --strategy tailwindmix css_linter.analyze --strategy tailwind --output analysis.json--strategy- Analysis strategy to use (default: "tailwind")--output- Output file path for JSON export--paths- Comma-separated list of paths to scan (default: "lib")
Categorizes Tailwind CSS classes into groups:
- Layout (flex, grid, display)
- Spacing (padding, margin, gap)
- Sizing (width, height)
- Typography (font, text)
- Colors (bg, text, border colors)
- Effects (shadow, opacity, blur)
- DaisyUI Components
- And more...
CSS Analysis Report
==================
Total Files Scanned: 45
Total Classes Found: 258 unique (1,191 occurrences)
Top 10 Classes:
flex: 45 occurrences
gap-4: 32 occurrences
btn: 28 occurrences
...
By Category:
layout: 156 occurrences (45 unique)
spacing: 134 occurrences (38 unique)
daisyui-component: 89 occurrences (12 unique)
...
MIT
See INSTALLATION.md for complete setup instructions.
Quick start:
{:css_linter, github: "vintrepid/css_linter"}Then:
mix deps.get
mix css_linter.analyze --strategy tailwind --output analysis.jsonWeb UI components (LiveViews for viewing analysis) are currently in development.
For now, see Maestro project for reference LiveView implementations:
TailwindAnalysisLive- Analysis dashboardPageInventoryLive- HTML tag search across pages
These can be copied and adapted to your project.