2015-09-09 144 views
0

我學習的Clojure和我的項目在哪裏工作我使用的Compojure & & clostache(鬍子的Clojure的)如何將css文件包含到compojure項目中?

這是我的核心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") 
      ) 

我的問題是:我怎麼能包括CSS文件在我小鬍子文件?這個問題與此有關嗎? 小鬍子擴展或關於compojure的工作方式?

PS:沒有找到鏈接標籤css文件(404)。

+0

你的css文件在哪裏?你可以拿他們嗎? (例如,通過在瀏覽器中轉到localhost:port/css/yourfile.css)。 –

回答

2

如果您使用lein的compojure模板創建項目,那麼在項目根目錄下有一個名爲${project_root}/resources/public的目錄。像.html,.js,,.css這樣的靜態文件可以駐留在目錄中。

例如,你可以使目錄結構是這樣的:

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

在上述結構中,您可以通過/css/style.css訪問由/index.htmlindex.htmlstyle.css,等等。

+0

我沒有資源中的公用文件夾。非常感謝! :) –

相關問題