css - 如何将css文件包含到compojure元素中?

标签 css clojure compojure ring

我正在学习 clojure,并且我正在使用 compojurering & 元素clostache (clojure 的 mustache )

这是我的核心 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:未找到带有链接标记的 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,通过/访问style.css css/style.css,等等。

关于css - 如何将css文件包含到compojure元素中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32484636/

相关文章:

clojure - 为什么我们需要 ' in (require ' [...]]) 和 Clojure?

macos - Clojure 在本地目录中找不到 .clj。和 ./classes 在 CLASSPATH

clojure - Compojure 路由参数为空

css - WordPress 自定义动画 CSS

css - Scss - 禁用点击边框

html - 有没有办法在CSS中创建动态实用类?

ssl - 如何使用 java -Djavax.net.debug=true 选项启动 Leingen?

clojure - 从 compojure 和 ring 提供静态文件

clojure - 将 compojure noir 转换为 Liberator

jquery - 当屏幕较小时,有没有办法控制我的div在class =“row”内的垂直对齐方式