3.23.3 Predicates
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog HTTP support
        • The HTTP server libraries
          • library(http/html_head): Automatic inclusion of CSS and scripts links
            • Predicates
              • html_resource/2
              • html_current_resource/1
              • html_requires//1
              • html_insert_resource//1
              • mime_include//2
Source[semidet,multifile]mime_include(+Mime, +Path)//
Hook called to include a link to an HTML resource of type Mime into the HTML head. The Mime type is computed from Path using file_mime_type/2. If the hook fails, two built-in rules for text/css and text/javascript are tried. For example, to include a =.pl= files as a Prolog script, use:
:- multifile
    html_head:mime_include//2.

html_head:mime_include(text/'x-prolog', Path) --> !,
    html(script([ type('text/x-prolog'),
                  src(Path)
                ],  [])).