Skip to content

Instantly share code, notes, and snippets.

@Lcfvs
Created January 17, 2019 20:13
Show Gist options
  • Select an option

  • Save Lcfvs/53f3a2ee88128c4fb6c7a4e93ff35193 to your computer and use it in GitHub Desktop.

Select an option

Save Lcfvs/53f3a2ee88128c4fb6c7a4e93ff35193 to your computer and use it in GitHub Desktop.
Simple server exception manager, for anticore. Try it with https://github.com/Lcfvs/anticore-default-project
// create this file
import { anticore } from 'anticore'
import { one } from 'anticore/dom/query/one'
import { replace } from 'anticore/dom/tree/replace'
anticore.on('main.exception', function (element, next, loaded) {
loaded && replace(element, one('body > main'))
next()
})
// add the following line into your index.js, BEFORE the `anticore.defaults().populate()`
import './exception.md'
<!-- create this file -->
<main class="exception">
<h1>Page not found</h1>
<a href="">Restart</a>
</main>
<!-- add the following line into your index.html file -->
<a href="./fragments/404.html">Load the 404</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment