Jeff Triplett

TIL: Creating a Rustywind pre-commit hook

Filed under: rustywind, tailwindcss, pre-commit, pre-commit hooks

Thanks to Adam Johnson’s pre-commit: How to create hooks for unsupported tools. I created a pre-commit hook for rustywind, which is a CLI tool that organizes, lints, and sorts Tailwind CSS classes.

If you are comfortable with pre-commit, this should be a copy and paste for you to have nicely formatted Tailwind CSS linting/auto-formatting.

# .pre-commit-config.yaml
repos:
  - repo: local
    hooks:
      - id: rustywind
        name: rustywind Tailwind CSS class linter
        language: node
        additional_dependencies:
          - rustywind@latest
        entry: rustywind
        args: [--write]
        types_or: [html]