Skip to content

Commit

Permalink
Merge pull request #36 from michalsn/prepare-release
Browse files Browse the repository at this point in the history
Prepare release 1.2.0
  • Loading branch information
michalsn authored Jun 6, 2023
2 parents c03b86b + 984a735 commit 30dfa95
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [1.2.0](https://github.com/michalsn/codeigniter-htmx/compare/v1.1.0...v1.2.0) - 2023-06-06

### Enhancements
- Add support for displaying the Debug Toolbar after `htmx` request.

### Changed
- The added JavaScript is now placed in the `head` tag.

## [1.1.0](https://github.com/michalsn/codeigniter-htmx/compare/v1.0.0...v1.1.0) - 2023-01-10

### Enhancements
Expand Down
23 changes: 6 additions & 17 deletions docs/debug_toolbar.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
# Debug Toolbar

Although the Debug Toolbar rendering is disabled for HTMX requests, you can still access the toolbar
for a given request by checking the URL in the `debugbar-link` response header.
As long as you **don't use** the [head-support](https://htmx.org/extensions/head-support/) extension,
the Debug Toolbar should work out of the box. It will be updated after every request, so please remember
it will only display the latest information. If you want to see what happened in earlier request,
use the `History` tab in the Toolbar.

### Other options

Alternatively, if you're rendering content only inside the `body` tag, you can use the snippet below.

```js
htmx.on('htmx:afterRequest', function (ev) {
let debugBarTime = ev.detail.xhr.getResponseHeader("debugbar-time");
if (debugBarTime !== null) {
loadDoc(debugBarTime);
}
});
```

It will cause the Debug Toolbar, rendered by the "regular" request, to be automatically
replaced which information from the current HTMX request.
If you're using the `head-support` extension then the Debug Toolbar rendering will not work for `htmx` requests.
You can still access the toolbar for a given request by checking the URL in the `debugbar-link` response header.

0 comments on commit 30dfa95

Please sign in to comment.