Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not return Template when Pre-Processing as a partial using AMD #176

Open
rcampbel opened this issue Mar 11, 2021 · 0 comments
Open

Comments

@rcampbel
Copy link

Template:

This is just a basic template example

Job Options:

options: {
  partialRegex: /^/,
  processPartialName: function (filePath) {
    return filePath.replace(/^.*?templates\/(partials\/)?(.*?)\.(hbs|html)$/i, '$2');
  },
  amd: function amd(hbsFileName, ast) {
    var dependcies = ['Handlebars', 'plusMore'];
    return dependcies.join('\', \'');
  },
  processContent: function processContent(content) {
    return content.replace(/^[\x20\t]+/mg, '')
      .replace(/[\x20\t]+$/mg, '')
      .replace(/^[\r\n]+/, '')
      .replace(/[\r\n]*$/, '\n');
  }
}

Expected:

define(['Handlebars', 'plusMore'], function(Handlebars) {
var template;
Handlebars.registerPartial("basic", template = Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    return "This is just a basic template example\n";
},"useData":true}));

return template;

});

Actual

define(['Handlebars', 'plusMore'], function(Handlebars) {

Handlebars.registerPartial("basic", Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    return "This is just a basic template example\n";
},"useData":true}));

return ;

});

Notice the return statment returns undefined, I would expect that it would return the partial/template no mater what.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant