plt-web: record directory-to-URL mapping in destination

This commit is contained in:
Matthew Flatt 2014-03-02 20:17:37 -07:00
parent 9e716b0422
commit 8b4c5d3deb
2 changed files with 16 additions and 4 deletions

View File

@ -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.}

View File

@ -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")