0

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 ?

Michel L
  • 456
  • 7
  • 19
  • Maybe some help here https://pebbletemplates.io/wiki/guide/installation/ "If you do not provide a custom Loader, Pebble will use an instance of the DelegatingLoader by default. This delegating loader will use a ClasspathLoader and a FileLoader behind the scenes to find your templates.". Seems to be more complicated than I would have expected. – Michel L Apr 18 '19 at 12:38

1 Answers1

1

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

Michel L
  • 456
  • 7
  • 19