How to use this library with ember-cli?


#1

I found this library which I want to use for my ember-cli project. https://github.com/marianoguerra/json.human.js

But it doesn’t have the AMD style version. Since I am new to the js module resolver field, I don’t have any idea on how to require/import it and use it.

Can anyone guide me on this?


#2

Take a look at how I added marked to this ember-cli project https://github.com/broerse/ember-cli-blog I thinks you can do the same for your library.


#3

Well I pulled that repo and looked around. But I think its not the same case. The library marked has the global function defined as marked which is what you’ve added in the format-markdown.js helper as:

return new Ember.Handlebars.SafeString(marked(value));

But In my case, there isn’t any globally defined JsonHuman?


#4

I just tried it and it almost works.

https://github.com/broerse/ember-cli-blog/tree/json.human

The module can’t find crel result = crel("span", but it seems I can call JsonHuman.format(value));

https://github.com/broerse/ember-cli-blog/blob/json.human/app/helpers/json-human.js

I hope you can find this last step.


#5

Not tested yet but perhaps also add app.import('bower_components/json-human/lib/crel.js'); to brocfile.js ??

Tested now. It removes the error but there is no output yet.


#6

I uploaded a working version:

https://github.com/broerse/ember-cli-blog/tree/json.human


#7

@broerse Thanks for your effort and help. I’ll check it out.