How to add a CSS stylesheet?

Warning: css_link and make_uri come from Eliom_content.Html.D module. This module is opened for each piece of code

CSS stylesheet are included in the header using the css_link function.

css_link
     ~uri:(make_uri (Eliom_service.static_dir ())
              ["css";"style.css"])
     ()

This function has 2 parameters: the file path and unit.

The file path is generated using the make_uri function. This function creates the relative URL string using the static directory configured in the configuration file and the given list.

Where?

Insert this piece of code on the list given in parameter to the head function:

(html
     (head (title (pcdata "Page Title"))
        [css_link ~uri:(make_uri (Eliom_service.static_dir ())
	        	  ["css";"style.css"]) ()])
     (body [p [pcdata "Hello World!"]]))))

Or you can use: Eliom_tools.​F.​head

Download full code

Warning: This third party code may be outdated. Please notify the author is something is broken, or do a pull request on github.

Links