Releases: KnifeLemon/CommentTemplate
v1.0.9.1
🐛 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 asa$.j0S6...(backreferences replaced with empty strings) - Fix: Escape
\and$in the replacement string usingstr_replace(['\\', '$'], ['\\\\', '\\$'], $html)before passing topreg_replace()
Full Changelog: v1.0.9...v1.0.9.1
v1.0.9
✨ 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
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@echodirectives 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
[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
@echodirective 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