Skip to content
Browse files

Added CSS resource

  • Loading branch information...
1 parent 13cff55 commit 97bb392ac691abf62a11047e9a306cd675fcb8b3 @weavejester committed
Showing with 30 additions and 6 deletions.
  1. +3 −2 project.clj
  2. +8 −0 resources/public/css/style.css
  3. +19 −4 src/compojure/example/routes.clj
View
5 project.clj
@@ -1,6 +1,7 @@
(defproject compojure-example "0.1.0"
:description "Example Compojure project"
:dependencies [[org.clojure/clojure "1.2.0"]
- [compojure "0.6.0-RC1"]]
- :dev-dependencies [[lein-ring "0.2.6"]]
+ [compojure "0.6.0-RC3"]
+ [hiccup "0.3.2"]]
+ :dev-dependencies [[lein-ring "0.3.0"]]
:ring {:handler compojure.example.routes/app})
View
8 resources/public/css/style.css
@@ -0,0 +1,8 @@
+h1 {
+ width: 100%;
+ margin-top: 5em;
+ text-align: center;
+ color: #44a;
+ font-size: 40pt;
+ font-family: sans-serif;
+}
View
23 src/compojure/example/routes.clj
@@ -1,7 +1,22 @@
(ns compojure.example.routes
- (:use compojure.core)
- (:require [compojure.route :as route]))
+ (:use compojure.core
+ [hiccup core page-helpers])
+ (:require [compojure.route :as route]
+ [compojure.handler :as handler]
+ [compojure.response :as response]))
-(defroutes app
- (GET "/" [] "Hello World")
+(defn index-page []
+ (html5
+ [:head
+ [:title "Hello World"]
+ (include-css "/css/style.css")]
+ [:body
+ [:h1 "Hello World"]]))
+
+(defroutes main-routes
+ (GET "/" [] (index-page))
+ (route/resources "/")
(route/not-found "Page not found"))
+
+(def app
+ (handler/site main-routes))

0 comments on commit 97bb392

Please sign in to comment.
Something went wrong with that request. Please try again.