knots

Tie CommonJS modules to certain pages and components

Usage no npm install needed!

<script type="module">
  import knots from 'https://cdn.skypack.dev/knots';
</script>

README

Knots

Tests Status

Example

const Knots = require('knots');
const knots = new Knots();

knots.tie('base', () => [require('./partials/header.js'), require('./partials/footer.js']);
knots.tie('page:contact', () => [require('./pages/contact.js')]);

knots.run(['base']);

header.js

module.exports = function HeaderPartial() {
    // stuff

    return () => {
        // onload
    }
}