aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Xhtml.hs
diff options
context:
space:
mode:
authorTim Baumann <tim@timbaumann.info>2017-09-23 22:02:01 +0200
committerAlexander Biehl <alexbiehl@gmail.com>2017-09-23 22:02:01 +0200
commite99aefb50ca63e2dbcc95841efbb53cea90151d8 (patch)
tree3ab0cebcd012122631336281dceb389dd0fd4506 /haddock-api/src/Haddock/Backends/Xhtml.hs
parentfe4c6c7d2907a79118d836e72c0442d666091524 (diff)
Add compile step that bundles and compresses JS files (#684)
* Add compile step that bundles and compresses JS files Also, manage dependencies on third-party JS libraries using NPM. * Compile JS from TypeScript * Enable 'noImplicitAny' in TypeScript * QuickJump: use JSX syntax * Generate source maps from TypeScript for easier debugging * TypeScript: more accurate type * Separate quick jump css file from ocean theme
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Xhtml.hs')
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml.hs28
1 files changed, 7 insertions, 21 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs
index f85ee6b3..e8148782 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml.hs
@@ -107,10 +107,9 @@ copyHtmlBits odir libdir themes = do
copyCssFile f = copyFile f (combine odir (takeFileName f))
copyLibFile f = copyFile (joinPath [libhtmldir, f]) (joinPath [odir, f])
mapM_ copyCssFile (cssFiles themes)
- copyLibFile jsFile
- copyLibFile jsFuseFile
- copyLibFile jsIndexFile
- copyLibFile jsPreactFile
+ copyCssFile (joinPath [libhtmldir, quickJumpCssFile])
+ copyLibFile haddockJsFile
+ copyLibFile jsQuickJumpFile
return ()
@@ -120,13 +119,9 @@ headHtml docTitle themes mathjax_url =
meta ! [httpequiv "Content-Type", content "text/html; charset=UTF-8"],
thetitle << docTitle,
styleSheet themes,
- script ! [src jsFile, thetype "text/javascript"] << noHtml,
- script ! [src mjUrl, thetype "text/javascript"] << noHtml,
- script ! [thetype "text/javascript"]
- -- NB: Within XHTML, the content of script tags needs to be
- -- a <![CDATA[ section.
- << primHtml
- "//<![CDATA[\nwindow.onload = function () {pageLoad();};\n//]]>\n"
+ thelink ! [ rel "stylesheet", thetype "text/css", href quickJumpCssFile] << noHtml,
+ script ! [src haddockJsFile, emptyAttr "async", thetype "text/javascript"] << noHtml,
+ script ! [src mjUrl, thetype "text/javascript"] << noHtml
]
where
mjUrl = maybe "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" id mathjax_url
@@ -190,16 +185,7 @@ bodyHtml doctitle iface
"Produced by " +++
(anchor ! [href projectUrl] << toHtml projectName) +++
(" version " ++ projectVersion)
- ),
-
- script ! [src jsPreactFile, thetype "text/javascript"] << noHtml,
- script ! [src jsFuseFile, thetype "text/javascript"] << noHtml,
- script ! [src jsIndexFile, thetype "text/javascript"] << noHtml,
- script ! [thetype "text/javascript"]
- -- NB: Within XHTML, the content of script tags needs to be
- -- a <![CDATA[ section.
- << primHtml
- "//<![CDATA[\nquickNav.init();\n//]]>\n"
+ )
]
moduleInfo :: Interface -> Html