Skip to content
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.

Docs seems outdated #103

Closed
sielay opened this issue Jan 28, 2016 · 4 comments
Closed

Docs seems outdated #103

sielay opened this issue Jan 28, 2016 · 4 comments

Comments

@sielay
Copy link

sielay commented Jan 28, 2016

Hi

Docs say you can do

var adaro = require('adaro'),
instance = adaro(options);

and those options can pass helpers. But it's not a case anymore, as export from adaro module is not a function. Either this

adaro.dust({ ... })

won't pass helpers, only way that seems working for me is

var dust = adaro.dust({});
dust.dust.helpers = ...
@grawk
Copy link
Member

grawk commented Jan 28, 2016

Hi @sielay. Can you please point out the exact document and section that is misleading? This module's README doesn't appear to show such an example.

@sielay
Copy link
Author

sielay commented Jan 29, 2016

In your readme - you take module exports of adaro to adaro var (example 1)

var adaro = require('adaro');

You pass helpers via options (example 2)

var options = {
  helpers: [
    //NOTE: function has to take dust as an argument.
    //The following function defines @myHelper helper
    function (dust) { dust.helpers.myHelper = function (a, b, c, d) {} },
    '../my-custom-helpers',   //Relative path to your custom helpers works
    'dustjs-helpers',   //So do installed modules
    {
      name: '../my-custom-helpers/helper-to-render-data-with-args',
      // or use this signature if you need to pass in additional args
      arguments: { "debug": true }
    }
  ]
};

And now this is version of current readme

app.engine('dust', adaro.dust(options));

and that is version of doc in package on npm

app.engine('dust', adaro(options)); 

Change happened here fd7d42f but seems to not be reflected in npm.

Version in npm will throw error that adaro is not a function (example 1)

Still, if I pass helpers I don't have them registered then in dust instance in adaro object given by invoking adaro(options). To make them appear I had to do something like

let dust = adaro.dust({
        cache: false
    });

    dust.dust.helpers = helpers;

    server.engine('dust', dust);

This finally worked for me.

I think both issues may be due to npm not updated.

@grawk
Copy link
Member

grawk commented Jan 29, 2016

The first issue is documentation related. I didn't look at what was showing on npm until now, but I see that since v1.0.1 was published there are a couple changes to the README. I'll publish those as v1.0.2.

Regarding your issue registering helpers, that looks like a separate one to me.

Let's address the documentation with this issue and deal with the helpers issue separately.

@grawk
Copy link
Member

grawk commented Jan 29, 2016

Resolved with the publish of v1.0.2.

@grawk grawk closed this as completed Jan 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants