使用mustache,enlive和Clojure将图像文件渲染到html页面

时间:2022-08-25 19:10:56

In my application with moustache (a micro framework to to wire Ring handlers and middlewares), enlive (as html template engine), and clojure, I can't view the images in my html file. How to render these file to html?

在我的应用程序中使用小胡子(一个用于连接环处理程序和中间件的微框架),活跃(作为html模板引擎)和clojure,我无法在我的html文件中查看图像。如何将这些文件呈现为html?

1 个解决方案

#1


3  

If you have your files locally, make sure Ring has a route that maps to your images.

如果您在本地拥有文件,请确保Ring具有映射到您的图像的路径。

This the doc for the needed method: API for middleware.file

这是所需方法的文档:中间件.file的API

And then make sure you have something like this in your routes:

然后确保你的路线中有这样的东西:

(def routes
  (app
    (wrap-file "resources")
     ..))

#1


3  

If you have your files locally, make sure Ring has a route that maps to your images.

如果您在本地拥有文件,请确保Ring具有映射到您的图像的路径。

This the doc for the needed method: API for middleware.file

这是所需方法的文档:中间件.file的API

And then make sure you have something like this in your routes:

然后确保你的路线中有这样的东西:

(def routes
  (app
    (wrap-file "resources")
     ..))