[hunchentoot-devel] How to use/generate/access javascript/css?

Hi all, Sorry for the newbie questions, I'm curious as to how people working with tbnl/hunchentoot create/maintain their javascript and css files. If you use js/css generators, what are those (I know of only parenscript). If I'm using cl-who to generate my html, how can I include a .css or .js file in this code (or, where do I need to place these files to be accessible by hunchentoot? TIA, Vamsee.

Vamsee Kanakala wrote:
Sorry for the newbie questions, I'm curious as to how people working with tbnl/hunchentoot create/maintain their javascript and css files.
I mostly use static css and js files. I put them in the root directory of my website and then create a handler for those specific extensions*. If I have more than a few I simply put them into css/ and js/ folders. To include them, just generate the relevant HTML code: (:html (:head (:link :href "myfile.css" :rel "stylesheet" :type "text/css") (:script :src "myfile.js" :type "text/javascript" nil) ... The last nil creates <script></script> which works better than <script/> If I need to generate dynamic css or js snippets, I just put them into the HTML page: <style> tags in head and <script> tags in head or body. HTH Toby *: (create-extension-dispatcher-and-handler '("html" "css" "js")) where: (defun create-extension-dispatcher-and-handler (extensions) (create-regex-dispatcher (format nil "^/[^/]+\\.(~{~A~^|~})$" extensions) (lambda () (handle-static-file (string-left-trim "/" (script-name))))))

Toby wrote:
I mostly use static css and js files. I put them in the root directory of my website and then create a handler for those specific extensions*. If I have more than a few I simply put them into css/ and js/ folders.
Thanks for the tips Toby, things are much clearer now. I posted a similar question to lispweb before seeing this reply. Sorry for the cross post. Regards, Vamsee.
participants (2)
-
Toby
-
Vamsee Kanakala