如何将 css 文件包含到 compojure 项目中?

How to include css files into compojure project?

我正在学习 clojure,并且我在使用 compojure & [=20 的项目中工作=]ring & clostache (clojure 的小胡子) .

这是我的核心 clojure 文件:

(defroutes public-routes
       (GET "/" [] (controller/index))
       (route/resources "/")
       (GET "/index" [] (controller/index))
       (route/resources "/")
       (GET "/customers" [] (controller/customers))
       (route/resources "/")
       (GET "/employees" [] (controller/employees))
       (route/resources "/")
    )

(defroutes app-routes   public-routes
           (route/not-found "404 Not Found")
           )

我的问题是:如何在我的 .mustache 文件中包含 CSS 个文件?这个问题与 .mustache 扩展名有关,还是与 compojure 的工作方式有关?

PS: 带有 link 标签 css 文件未找到 (404)。

如果您使用带有 lein 的 compojure 模板创建了项目,那么在您的项目根目录下会有一个名为 ${project_root}/resources/public 的目录。 .html.js,.css 等静态文件可以驻留在目录中。

例如,您可以将目录结构做成这样:

${project_root}/resources/public/index.html
                                /js/util.js
                                /css/style.css

在上面的结构中,可以通过/index.html访问index.html,通过/css/style.css访问style.css,依此类推。