Assembly: register auxiliary steering function

I am using assemble 0.4.17, which includes the handle 1.3.0.
I am trying to add a custom descriptor helper as described here .

So, I added this to my Gruntfile (at the bottom of the file, out module.exports = function(grunt) {)

Gruntfile.js

module.exports.asdf = function (str)  {  return 'asdf here!'; };

And added this to
index.hbs

{{#asdf}}
  bobo
{{/asdf}}

And I would suggest that it asdf here!will be displayed in the generated html, but it is not, instead, only an empty line is printed. I also tried the method module.exports.register = function (Handlebars, options), but that did not work. Does anything else need to be added to add this helper helper?

I'm new to assembly and rug and steering, so I can just skip the obvious

+4
1

helpers :

-helper.js

module.exports.asdf = function (str) { return 'asdf here!'; };

Gruntfile.js

grunt.initConfig({
  assemble: {
    options: {
      helpers: ['./my-helper.js']
    },
    someTarget: {
      ...
    }
  }
});
+6

Source: https://habr.com/ru/post/1524878/


All Articles