Hi Robert

You could always do the following:

<sling:include path="<%= resource.getPath() %>.config.js"
        resourceType="my/component"/>

Regards
Julian


On Wed, Feb 4, 2015 at 12:47 PM, Robert Munteanu <romb...@apache.org> wrote:
> Hi,
>
> I have a ResourceResolver.getResource call which I would like to replace
> with a <sling:include /> .
>
> What I currently have
>
>         Resource configResource =
>         resolver.getResource("my/component/config.js.jsp");
>         <cq:include script="<%=configResource.getPath()%>" />
>
> What I want to have
>
>         <sling:include resource="<%= resource %>"
>         resourceType="my/component" replaceSelectors="config" />
>
> The problem here is that I need the extension to be set as well ( the
> original request's extension is set to .html ).
>
> A brief test done by creating a resource with sling:resourceType
> "my/component" at /content/test revealed that
>
> - /content/test.config.js returns the right content
> - /content/test.config.html does not
>
> So my questions are:
>
> 1. Is there a way I can convince sling:include to include the extension?
> 2. Is there isn't, is this a valid enhancement request?
>
> Thanks,
>
> Robert
>

Reply via email to