[Ur] Stylesheet questions

Edward Z. Yang ezyang at MIT.EDU
Tue Jan 1 19:33:40 EST 2013


Hello Byrn,

Ur currently doesn't have very much support for serving resources
like CSS; so the onus is on you to run another webserver which hosts
your static resources and then setup <link> to point to the URL (make
sure you allow the URL in the urp.)

> Alternatively, if I wanted to generate the styles dynamically, would I
> write that as unit -> transaction blob, or something else? Something like
> the following?
> 
> fun blogStyle () =
>     returnBlob (textBlob ".blogPost {background-color:red; }")
>                     (blessMime "text/css")
> 
> 
> How would I then reference that in a <link> element? There's no "link"
> field for <link>s like there is for <a>s, so the usual {foo ()}
> interpolation within an <xml> document doesn't look like it works -
> link.Href wants an url, not a transaction blob.

I'm not 100% sure if this is ultimately a good solution, but you use
'url (blogStyle ())' to get a URL which is valid for href.

Cheers,
Edward



More information about the Ur mailing list