How to use Ramda on Ember?


#1

I’ve been trying to use Rambda in Ember but been unable to do it.

I’ve tried installing the addons ember-cli-ramda and ember-ramda, but neither of them works well.

Have anybody here worked before with that?

And in any way: What if I simply want to import ramda without depending on a 3rd party addon maintainer: I want to depend only on the ramda developers: How can I simply use Ramda?


#2

If you want to use it without an addon maintainer the old answer used to be to use bower, but I believe the new best practice is to make an ‘in-repo’ addon in your project which correctly loads all of the necessary resources in an ember-ready format. I believe it’s basically some broccoli config to tell broccoli how to process it. Unfortunately I can’t give you more specifics as I’ve never done that, but I’m sure if you look for some resources on in-repo addons and then ask here or in the slack channel if you get stuck someone more experienced with that could help you out. Good luck!


#3

I agree with @dknutsen that this should be added as NPM module to the broccoli tree. There is a bower based version that looks like it should work. See https://github.com/omninnov/ember-fp

If you like to create a NPM based version do something like this

    var ramda = stew.find(path.join(path.dirname(require.resolve('ramda')), '..', 'dist'), {
      destDir: 'ramda',
      files: ['ramda.js']
    });

as done here https://github.com/martinic/ember-cli-marked/blob/master/index.js#L11

Make sure you use the version in the dist folder.