0

我有一个 Spring Boot Java Web 应用程序。该应用程序可以使用 Pebble 生成网页。Pebble 使用的所有资源都位于application.war\WEB-INF\classes中。然后,在 Pebble 引擎中获取模板。在这个模板中,我需要包含一个可以位于文件系统中任何位置的 css,例如:

<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>

我无法包含 custom-css.css。错误是com.mitchellbosecke.pebble.error.LoaderException:找不到模板

我在文档( https://pebbletemplates.io/wiki/tag/include/)和这里(https://groups.google.com/forum/#!topic/pebble-templating-engine/ )中找不到任何帮助2gK9B1twwKw )

任何想法 ?

4

1 回答 1

1

我发现了这个问题。我的引擎仅使用类路径加载器而不是默认的类路径加载器和文件加载器进行了初始化。

于 2019-04-18T13:33:24.020 回答