Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
JaapJoris committed Dec 16, 2022
1 parent b26c430 commit 295a54c
Showing 1 changed file with 32 additions and 22 deletions.
54 changes: 32 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,37 +138,47 @@ Then, add the following to your `.pre-commit-config.yaml`:

```yml
repos:
- repo: https://github.com/rtts/djhtml
rev: 'main' # replace with the latest tag on GitHub
hooks:
- id: djhtml
- id: djcss
- id: djjs
- repo: https://github.com/rtts/djhtml
rev: 'main' # replace with the latest tag on GitHub
hooks:
- id: djhtml
- id: djcss
- id: djjs
```

Now run `pre-commit autoupdate` to automatically replace `main` with
the latest tag on GitHub,
[as recommended by pre-commit](https://pre-commit.com/#using-the-latest-version-for-a-repository).

If you want to override a command-line option, for example to change
the default tabwidth, you change the `entry` point of these hooks:

```yml
hooks:
- id: djhtml
# Use a tabwidth of 2 for HTML files
entry: djhtml -i -t 2
- id: djcss
- id: djjs
```

If you want to limit the files these hooks operate on, you can use
[pre-commit mechanisms for filtering](https://pre-commit.com/#filtering-files-with-types).
For example:

```yml
- repo: https://github.com/rtts/djhtml
rev: 'main' # replace with the latest tag on GitHub
hooks:
- id: djhtml
# Indent only HTML files in template directories
files: .*/templates/.*\.html$
- id: djcss
# Run this hook only on SCSS files (CSS and SCSS is the default)
types: [scss]
- id: djjs
# Exclude JavaScript files in vendor directories
exclude: .*/vendor/.*
hooks:
- id: djhtml
# Indent only HTML files in template directories
files: .*/templates/.*\.html$
- id: djcss
# Run this hook only on SCSS files (CSS and SCSS is the default)
types: [scss]
- id: djjs
# Exclude JavaScript files in vendor directories
exclude: .*/vendor/.*
```

Finally, run `pre-commit autoupdate` to automatically replace `main`
with the latest tag on GitHub,
[as recommended by pre-commit](https://pre-commit.com/#using-the-latest-version-for-a-repository).

Now when you run `git commit` you will see something like the
following output:

Expand Down

0 comments on commit 295a54c

Please sign in to comment.