Implementing the TiltYieldingFilter #28
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi All,
The purpose of this filter is to allow templates that adhere to the Tilt interface to yield to other templates, and be able to generate the final result from the nested structure. For example, if we have a slim template called
layout.slim
that we wanted to use as the layout for all of our HTML pages, it might look something like the following.doctype html html lang="en" head meta charset="utf-8" title template body == yield
For completeness, say we have an
index.slim
as follows where we want to use the template above as our layout for the index.Using the
TiltYieldingFilter
, we can create an Assetfile to generate the desired result. For instance:Building the Assetfile above, the filter would run the
index.slim
through Tilt, and then pass that result as the value for the yield in thelayout.slim
.I am sure there is a more elegant way to do this, but I couldn't manage to get it going with the current filters out there. Though, maybe I am missing something! Anyways, if you have any suggestions or want to accept the pull request, that would be great!
Best,
-Eric
PS - I was thinking to modify the existing
TiltFilter
, but the behavior of thegenerate_output
is so different that I thought it was cleaner to just make a new filter. I'd be open to working in the functionality toTiltFilter
though.