jaredwray / fumanchu

Handlebars + Helpers Together :heart:
https://fumanchu.org
MIT License
11 stars 2 forks source link

ES6 import #26

Closed hkjeffchan closed 11 months ago

hkjeffchan commented 12 months ago

Any chance to rewrite it to support es6 import syntax like the following?

import { handlebars, handlebarHelpers } from '@jaredwray/fumanchu'; handlebars.registerHelper(handlebarHelpers);

hkjeffchan commented 12 months ago

oh... i am stupid. You combined them together already.

This works: import * as handlebars from '@jaredwray/fumanchu';

Any chance to make the following syntax works too? import handlebars from '@jaredwray/fumanchu';

jaredwray commented 11 months ago

@hkjeffchan - thanks so much and I have done a couple of things with this pull request https://github.com/jaredwray/fumanchu/pull/29 and latest release.

Due to destructuring I believe the best case is to make it so you can do standard es6 without the * so right now it would look like this.

import handlebars from '@jaredwray/fumanchu';

if you want to access just the helpers then you would do it like this:

import fumanchu from '@jaredwray/fumanchu';
cost {handlebarHelpers} = fumanchu;

With this you can get access to handlebarHelpers if you just want that. I have also added a small es6 test to validate this moving forward.