adobe / htl-spec

HTML Template Language Specification
Apache License 2.0
281 stars 145 forks source link

Clarify difference between data-sly-include and data-sly-resource #64

Closed tripodsan closed 6 years ago

tripodsan commented 6 years ago

the spec does not clearly state the difference between data-sly-include and data-sly-resource.

it would be nice to give an example.

tripodsan commented 6 years ago

when looking at the implementations of the extensions:

it looks like data-sly-resource creates a new internal request against the sling engine, where as data-sly-include looks for the specified script/servlet and executes it, using the same request context, i.e. the same current resource.

so data-sly-resource can be compared with a <jsp:include page="" /> and data-sly-include is similar to <%@ include file="" %>

@raducotescu correct?

raducotescu commented 6 years ago

@tripodsan, that's the correct analogy and the specification does mention this:

data-sly-include:

  • Includes the output of a rendering script run with the current context.

data-sly-resource:

  • Includes a rendered resource.
tripodsan commented 6 years ago

would be nice to update the specification. imo, only people familiar with sling might possibly understand the current description. I will provide a PR.