Insert template located anywhere in filesystem in Pebble template

1.1k Views Asked by At

I have a Spring Boot Java Web application. The application can generate web pages using Pebble. All resources used by Pebble are located in application.war\WEB-INF\classes. Then, in the Pebble engine gets the template. In this template, I need to include a css that can be anywhere in the filesystem, e.g.:

<html>
 <head>
    <style>
        {% include "/absolute/path/of/custom-css.css" %}
    </style>
</head>
    <p>{% include "this/works/because/foo/is/under/WEB-INF/classes/foo.html" %}</p>
</body>
</html>

I cannot get the custom-css.css to be included. Error is com.mitchellbosecke.pebble.error.LoaderException: Could not find template

I can't find any help in documentation (https://pebbletemplates.io/wiki/tag/include/) nor here (https://groups.google.com/forum/#!topic/pebble-templating-engine/2gK9B1twwKw)

Any idea ?

1

There are 1 best solutions below

0
On

I found the issue. My engine was initialized with the classpathloader only instead of the default classpathloader AND fileloader.