I found a fix and a workaround to get tablesorter working.
The sequence issue: In order to load all Javascript before the call to tablesorter(), I moved the scripts section in the default layout (
src/layouts/default.html.eco
) to be loaded as part of the<head/>
, not as the lats part of the<body/>
as it originally was.The defer issue: I couldn't figure out how to modify Docpad's
@getBlock('scripts')
to not include thedefer="defer"
setting. The workaround was then to not use getBlock and instead just hardcode the references to the script files.
In summary, going from this:
<html>
...
<body>
...
<%- @getBlock('scripts')...
</body>
</html>
to this:
<html>
<head>
...
<script src="/vendor/jquery/...
...
</head>
<body>
...
</body>
</html>
fixed the problem. I now have a maintenance problem that I have to maintain the list of scripts within the layout (instead of using the scripts: section in docpad.coffee); I can live with that.