;; in any SHP script 
`(script ((src ,(js-link "jquery.js" "jquery.ui.js" ...))) "")
and it will translate into the appropriate link. Let's see how it can be done.
Assuming the path is hardcoded (let's say "/js/"), then it's pretty straight forward:
(define js-base-path (make-parameter "/js"))
(define (js-url path . paths) 
  (let ((url (string->url (js-base-path))))
    (set-url-query! url (map (lambda (path)
                               (cons 's path))
                             (cons path paths)))
    (url->string url)))
Given the base path is set in a parameter, you can parameterize it to a different value. It would be nice to "automatically" set the
js-base-path based on where you call the value, but that might be more difficult than it's worth so it's out of scope for now.
 
 
No comments:
Post a Comment