pecr.cr
PECR
PECR is an extension of ECR
templates that supports partial rendering.
PECR should be a drop-in replacement of ECR (please file an issue if you discover this is not the case).
<% #partial my-partial -%>
: Start of partial named "my-partial"<% #end -%>
: End of the current partial
These should be lines of their own, as the partial is currently defined as starting on the line following the start tag, and ending on the line before the end tag. The dashes in "-%>" are optional, but suppresses any newlines when rendering the full template.
Rendering a partial is done by appending a hash and the name of the partial to the file name:
PECR.render("file.ecr#partial")
Installation
-
Add the dependency to your
shard.yml
:dependencies: pecr: github: xendk/pecr
-
Run
shards install
Usage
require "pecr"
PECR.render("file.ecr#partial")
Contributing
- Fork it (https://github.com/xendk/pecr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Thomas Fini Hansen - creator and maintainer
Repository
pecr.cr
Owner
Statistic
- 3
- 0
- 0
- 0
- 0
- 8 months ago
- February 20, 2024
License
MIT License
Links
Synced at
Mon, 18 Nov 2024 08:17:40 GMT
Languages