Skip to content

Releases: KnifeLemon/CommentTemplate

v1.0.9.1

27 Mar 05:44

Choose a tag to compare

🐛 Bug Fix

Layout content merge: Fixed preg_replace backreference interpretation

When inserting page content into a layout via preg_replace(), the replacement string (page HTML) containing $ followed by digits (e.g. $2a$04$... from bcrypt hashes) was interpreted as regex backreferences, silently corrupting the output.

  • Cause: preg_replace(pattern, $html, $layoutHtml) treats $0, $2, $04, etc. in the replacement string as capture group references
  • Symptom: Values like $2a$04$.j0S6... rendered as a$.j0S6... (backreferences replaced with empty strings)
  • Fix: Escape \ and $ in the replacement string using str_replace(['\\', '$'], ['\\\\', '\\$'], $html) before passing to preg_replace()

Full Changelog: v1.0.9...v1.0.9.1

v1.0.9

20 Mar 02:47

Choose a tag to compare

✨ New Features

Asset priority ordering: All asset directives (css, cssSingle, js, jsAsync, jsDefer, jsTop, jsTopAsync, jsTopDefer, jsSingle, jsSingleAsync, jsSingleDefer) now support optional priority ordering via <!--@js(file, priority)-->

  • No priority: loaded in template order
  • All prioritized: sorted by priority number (ascending)
  • Mixed: prioritized files first, then non-prioritized in original order

Cache busting: New cacheBusting option appends ?{filemtime} query string to compiled asset URLs, forcing browser cache refresh on file updates

  • Constructor parameter: new Engine(..., cacheBusting: true)
  • Setter method: setCacheBusting(bool) / getCacheBusting()

📝 Documentation

README updated with priority ordering usage and examples
README updated with cache busting configuration and output examples
API Reference updated with new constructor parameter and methods


Full Changelog: v1.0.8...v1.0.9

v1.0.8

11 Feb 04:46

Choose a tag to compare

v1.0.8

🔧 Improvements

  • Multi-format comment support: Asset directives (@asset, @base64, @assetDir) now work in both HTML (<!-- -->) and CSS/JS (/* */) comment styles
  • Template variables in @echo: Enable use of template variables within asset @echo directives for enhanced flexibility

🐛 Bug Fixes

  • Prevent duplicate asset root paths in URL generation
  • Improve asset path handling to avoid path duplication issues

Full Changelog: v1.0.7...v1.0.8

v1.0.7

20 Jan 13:04

Choose a tag to compare

[v1.0.6] Enable template variables in asset @echo directives and refactor echo processing

  • Pass template data to AssetCompiler to support variable access in JS/CSS files
  • Extract duplicate echo processing logic into EchoProcessor class
  • Add data parameter to AssetCompiler constructor
  • Create new EchoProcessor class with static process() method
  • Simplify Engine::processEcho() and AssetCompiler::processEchoInAsset()
  • Fixes Undefined variable error when using @echo(variable) in assets

This resolves the issue where template variables were not accessible
in @echo directives within JS/CSS files during asset compilation.


[v1.0.7] Add @echo directive for PHP code execution in templates

  • Add @echo directive to execute PHP expressions
  • Support nested parentheses and string literals in expressions
  • Works in HTML templates, CSS, and JavaScript files
  • Handle complex expressions like Flight::getUrl('route')
  • Update README.md with usage examples and documentation