Skip to content

Commit

Permalink
Merge branch 'release/5.0.2' into v5
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Sep 3, 2024
2 parents c5e113b + 7ffd024 commit 41d382f
Show file tree
Hide file tree
Showing 8 changed files with 1,378 additions and 632 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Template Comments Changelog

## 5.0.2 - 2024.09.03
### Fixed
* Fixed an issue with a change in Twig `3.12.0` (which is now used by Craft `5.4.0`) which would cause an exception to be thrown when rendering templates ([#44](https://github.com/nystudio107/craft-templatecomments/issues/44))

## 5.0.1 - 2024.08.06
### Fixed
* Fixed an issue where Template Comments would cause the Craft Closure `^1.0.6` package to not work
Expand Down
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
MAJOR_VERSION?=5
PLUGINDEV_PROJECT_DIR?=/Users/andrew/webdev/sites/plugindev/cms_v${MAJOR_VERSION}/
VENDOR?=nystudio107
PROJECT_PATH?=${VENDOR}/$(shell basename $(CURDIR))

.PHONY: dev docs release

# Start up the buildchain dev server
dev:
# Start up the docs dev server
docs:
${MAKE} -C docs/ dev
# Run code quality tools, tests, and build the buildchain & docs in preparation for a release
release: --code-quality --code-tests --buildchain-clean-build --docs-clean-build
# The internal targets used by the dev & release targets
--buildchain-clean-build:
--code-quality:
${MAKE} -C ${PLUGINDEV_PROJECT_DIR} -- ecs check vendor/${PROJECT_PATH}/src --fix
${MAKE} -C ${PLUGINDEV_PROJECT_DIR} -- phpstan analyze -c vendor/${PROJECT_PATH}/phpstan.neon
--code-tests:
--docs-clean-build:
${MAKE} -C docs/ clean
${MAKE} -C docs/ image-build
${MAKE} -C docs/ fix
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-templatecomments",
"description": "Adds a HTML comment with performance timings to demarcate `{% block %}`s and each Twig template that is included or extended.",
"type": "craft-plugin",
"version": "5.0.1",
"version": "5.0.2",
"keywords": [
"craftcms",
"craft-plugin",
Expand Down
12 changes: 6 additions & 6 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ It also records performance data, so you know how much overhead each `{% block %

With more complicated "content builder" setups, this can help bring clarity to where the various HTML on your pages is coming from.

Check warning on line 35 in docs/docs/index.md

View workflow job for this annotation

GitHub Actions / build (20.x)

"various" is a weasel word

This can be especially handy when dealing with OPC (Other People's Code). It solves [this problem](https://craftcms.stackexchange.com/questions/27769/how-can-i-print-the-name-of-every-template-being-rendered-in-html-comments-when).
This can be especially handy when dealing with OPC (Other Peoples Code). It solves [this problem](https://craftcms.stackexchange.com/questions/27769/how-can-i-print-the-name-of-every-template-being-rendered-in-html-comments-when).

Check warning on line 37 in docs/docs/index.md

View workflow job for this annotation

GitHub Actions / build (20.x)

"especially" can weaken meaning

![Screenshot](./resources/screenshots/templatecomments-example.png)

In Craft 5, it also adds support for [Rendering Elements](https://craftcms.com/docs/5.x/system/elements.html#rendering-elements) by outputting comments for the `_partials` templates that are rendered via Craft 5's `.render()` function:
In Craft 5, it also adds support for [Rendering Elements](https://craftcms.com/docs/5.x/system/elements.html#rendering-elements) by outputting comments for the `_partials` templates that are rendered via Craft 5s `.render()` function:

Check warning on line 41 in docs/docs/index.md

View workflow job for this annotation

GitHub Actions / build (20.x)

"are rendered" may be passive voice

![Screenshot](./resources/screenshots/templatecomments-render.png)


## Configuring Template Comments

All configuration is done via the `config.php`. For it to work, you'll need to copy it to your `craft/config/` directory, and rename it `templatecomments.php`
All configuration is done via the `config.php`. For it to work, youll need to copy it to your `craft/config/` directory, and rename it `templatecomments.php`

Check warning on line 48 in docs/docs/index.md

View workflow job for this annotation

GitHub Actions / build (20.x)

"is done" may be passive voice

Here's what the default settings look like:
Heres what the default settings look like:

```php
return [
Expand Down Expand Up @@ -90,9 +90,9 @@ return [

## Using Template Comments

Nothing much to say here; install the plugin, and it "just works". If `devMode` is off, it doesn't even install itself, so there should be zero effect in production.
Nothing much to say here; install the plugin, and it "just works". If `devMode` is off, it doesnt even install itself, so there should be zero effect in production.

Check warning on line 93 in docs/docs/index.md

View workflow job for this annotation

GitHub Actions / build (20.x)

"just" can weaken meaning

The `<<< END <<<` comments all include performance data in milliseconds, e.g.:
The `<<< END <<<` comments all include performance data in milliseconds, for example:
```html
<!-- 22.34ms <<< TEMPLATE END <<< templatecomments/_layout.twig -->
```
Expand Down
Loading

0 comments on commit 41d382f

Please sign in to comment.