Question about nested partial module loading
Currently, to load up partials you need to do:
import { register } from "./dist/module/mikado.js"
import tpl_header from "./tpl/header.es6.js";
register(tpl_header);
<main>
<section include="header"></section>
</main>
Is there any reason why the template compiler can't have an option to auto import and register all includes that show up in the template? Otherwise you have to manually import all nested partials. To be clear I mean nested template files, not tags.
Just the ES5 version do automatically register named templates. A module can't, because the template module otherwise needs to import Mikado from a irregular file path.
If you came up with an idea, let me know :)
Though when you bundle it, doesn't it resolve the path to Mikado?
A template function basically looks like:
export default {
name: "app",
tpl: {},
fn: []
}
We can't just import Mikado on top, because templates are nested in different folders and I would like to support the browser native ES6 module resolution. The ES5 version bundles everything on window.Mikado, that's why es5 compiled templates will automatically register (they need, because here we can't import).
So how about an optional flag that if someone wants to bundle their stuff it would register it?
That sounds good. I will add a compiler flag to set Mikado source root, so it can automatically register then. 👍