我正在尝试使用Gnuplot创建“画布” HTML文档。当我将其放入public /时,Mojolicious在/usr/share/gnuplot/gnuplot/5.2/js中的javascript和CSS文件上生成404。在不修改HTML输出的情况下,如何才能正确加载这些文件?
HTML内容:
<!DOCTYPE HTML>
<html>
<head>
<title>Gnuplot Canvas Graph</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--[if IE]><script type="text/javascript" src="excanvas.js"></script><![endif]-->
<script src="/usr/share/gnuplot/gnuplot/5.2/js/canvastext.js"></script>
<script src="/usr/share/gnuplot/gnuplot/5.2/js/gnuplot_common.js"></script>
<script src="/usr/share/gnuplot/gnuplot/5.2/js/gnuplot_dashedlines.js"></script>
...
</html>
Mojolicious错误:
[2019-04-02 16:02:55.54125] [10258] [debug] GET "/usr/share/gnuplot/gnuplot/5.2/js/canvastext.js" (f301442a)
[2019-04-02 16:02:55.54202] [10258] [debug] Template "not_found.development.html.ep" not found
[2019-04-02 16:02:55.54218] [10258] [debug] Template "not_found.html.ep" not found
[2019-04-02 16:02:55.54228] [10258] [debug] Rendering cached template "mojo/debug.html.ep"
[2019-04-02 16:02:55.54337] [10258] [debug] Rendering cached template "mojo/menubar.html.ep"
[2019-04-02 16:02:55.54890] [10258] [debug] 404 Not Found (0.007638s, 130.924/s)
我知道它将这些文件路径转换为URL,但是我不知道如何解决这个问题。
答案 0 :(得分:1)
正是出于这个原因,gnuplot canvas终端有一个选项“ jsdir”:
gnuplot> set term canvas jsdir 'http://wherever/the/scripts/live/'
输出* .html然后包含类似
的行<!--[if IE]><script type="text/javascript" src="excanvas.js"></script><![endif]-->
<script src="http://wherever/the/scripts/live/canvasmath.js"></script>
<script src="http://wherever/the/scripts/live/gnuplot_common.js"></script>
<script src="http://wherever/the/scripts/live/gnuplot_dashedlines.js"></script>
<script src="http://wherever/the/scripts/live/gnuplot_mouse.js"></script>