From 8b4c5d3debbe41c90e37e5ffdc55fb8ab3635f92 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 2 Mar 2014 20:17:37 -0700 Subject: [PATCH] plt-web: record directory-to-URL mapping in destination --- pkgs/plt-web-pkgs/plt-web-doc/plt-web.scrbl | 9 +++++---- pkgs/plt-web-pkgs/plt-web-lib/build.rkt | 11 +++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pkgs/plt-web-pkgs/plt-web-doc/plt-web.scrbl b/pkgs/plt-web-pkgs/plt-web-doc/plt-web.scrbl index 8a9adae77a..e547ac275f 100644 --- a/pkgs/plt-web-pkgs/plt-web-doc/plt-web.scrbl +++ b/pkgs/plt-web-pkgs/plt-web-doc/plt-web.scrbl @@ -46,9 +46,10 @@ relative directory is mapped to a destination URL via Creates a value that represents a site. If @racket[url] is not @racket[#f], then it will be registered to @racket[url-roots] for a -build in web mode (as opposed to local mode). If -@racket[always-abs-url?] is true, the @racket[url] is registered with -a @racket['abs] flag. +build in web mode (as opposed to local mode) and recorded as the +target for @racket[dir] in a @filepath{sites.rktd} file when building +in @tech{deployment mode}. If @racket[always-abs-url?] is true, the +@racket[url] is registered with a @racket['abs] flag. If @racket[share-from] is a site, then resources generated for the site (such as icons or CSS files) are used when as possible for the @@ -207,7 +208,7 @@ that is introduced by @racketmodname[plt-web]: @itemlist[ - @item{@Flag{w} or @DFlag{web} --- Build output in deployment mode, where references + @item{@Flag{w} or @DFlag{web} --- Build output in @deftech{deployment mode}, where references within a top-level site use relative paths, but references across top-level sites use absolute URLs. This mode is the default.} diff --git a/pkgs/plt-web-pkgs/plt-web-lib/build.rkt b/pkgs/plt-web-pkgs/plt-web-lib/build.rkt index 7c2dcb414a..42ed78c7a0 100644 --- a/pkgs/plt-web-pkgs/plt-web-lib/build.rkt +++ b/pkgs/plt-web-pkgs/plt-web-lib/build.rkt @@ -73,4 +73,15 @@ (printf " ignoring missing extra file: ~a\n" extra))) (parameterize ([current-directory output-dir]) (render-all))) + +(case build-mode + [(web) (call-with-output-file (build-path output-dir "sites.rktd") + #:exists 'truncate + (lambda (o) + (write (for/hash ([i (in-list (registered-url-roots))]) + (values (car i) (cadr i))) + o) + (newline o)))] + [else (void)]) + (printf "Done.\n")