I found a very basic web page on the Internet and now I would like to do the obvious thing and add some CSS so I can build nicer pages.
- How can I include jQuery, as well as other style sheets?
- How can I include inline CSS so I can throw in a text-align: center, for example, to try out quick changes?
Regular jQuery include:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"/>
Basic Hello World server without formatting: (Updated to include static routing fix so others will be up and running quicker)
(ns hello-world
(:use compojure))
(defn index
[request]
(html
[:h1 "Hello World"]
[:p "This is ugly with CSS!"])
)
(defn hello
[request]
(html ""
[:title "A very long title"]
[:div.comment
[:h1 "Hello's Page"]
[:p "This would look better with some CSS formatting!"]]
))
(defroutes greeter
(GET "/" index)
(GET "/h" hello)
(GET "/*"
(or (serve-file "/opt/compojure/www/public" (params :*)) ;; This is needed to find CSS and js files
:next))
(ANY "*"
(page-not-found) ;; 404.html is in /opt/compojure/www/public/404.html
))
(run-server {:port 9090}
"/*" (servlet greeter))