Possible to access Hogan via Instantsearch.js?

So for today’s random question of the day: is hogan accessible directly?

I need a client-side templating engine on a prototype that includes InstantSearch. I can include Hogan/Mustache/Handlebars et al directly (obviously), but since InstantSearch already uses Hogan and is already downloaded to the client, figured I’d try to save me a few kb’s of extra stuff on the initial load.

Been perusing the global object and the instantsearch.js code and I’m guessing the answer is no, but thought I’d ask!

To be clear, this has nothing to do with the search-related components on the page. Just trying to have my cake and eat it too :slight_smile:

Hi Chad :wave:

If I understand correctly you want to just use one version of Hogan.js, am I correct?

If you’re using NPM and you’re okay in using the same version as instantsearch.js you could just just this:

npm install --save hogan@3.0.2

Doing this will dedup the package inside your node_modules folder:

❯ npm ls hogan.js
test-hogan@1.0.0 /Users/gianlucabargelli/Code/test-hogan
├── hogan.js@3.0.2 
└─┬ instantsearch.js@2.8.0
  └── hogan.js@3.0.2  deduped

Let me know if this works out for you!

I appreciate your time on this.

No npm unfortunately, as it’s for a static site (Jekyll). InstantSearch is installed via CDN on the client.

I was hoping Hogan was accessible somehow from the InstantSearch variable, e.g.
const hogan = InstantSearch.hogan

I understand why it isn’t (thanks for keeping the global scope clean!), just thought I’d see if there might be creative ways to access Hogan still.

I considered making a feature request in the Github repo, but this seems like such a one-off use case.