faulknercs / Knockstrap

Knockout bindings to twitter bootstrap 3
faulknercs.github.io/Knockstrap/
MIT License
142 stars 37 forks source link

Support selective module loading #41

Open daedalus28 opened 8 years ago

daedalus28 commented 8 years ago

First, excellent work on this - it's saved me a fair bit of time and I really appreciate that. We're using your popover binding, but can't load in everything else because we have some conflicting utilities. We also have a custom template engine in place (for the amd-helpers) as well as our own version of the string template engine, so it would be tricky to try to include the whole library. Right now, we've pasted it (along with the utils) into a file but I would much prefer to require this in directly. It would be great if there was some way we could require in just the things we need like the popover binding. Perhaps you could write each file as its own AMD module so they could be required directly?

Alternatively, some sort of config option to alias or namespace the bindings might also work, but we'd still need a way to opt out of the template engine.

daedalus28 commented 8 years ago

Another alternative might be to put each thing behind a set of initialization functions like https://mbest.github.io/knockout.punches/ does. You could have one for each binding and convenience once that include them all, etc.

faulknercs commented 8 years ago

Thank you for your comment! I have thought about 2.0 version, which will provide each binding as umd module. Also it may allow usage of some initialization options to customize binding namespace, if you want include all of bindings.

I have already made some experiments with this, so when I will have enough time, I think, I implement this feature.