Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Custom File Extension Handlers #117

@zachleat

Description

@zachleat

Extension to the configuration API that would allow developers to add their own code to handle a new file extension template type.

Some fake code to get the discussion started:

const Vue = require("vue");
const renderer = require("vue-server-renderer").createRenderer();

eleventyConfig.addExtension("vue", function(path, fileContents) {
  return function(data) {
    var app = new Vue({
      template: fileContents,
      data: function() {
        return { data };
      }
    });

    return renderer.renderToString(app);
  };
});

Will process all *.vue files in the --input directory and write the files to --output.

Needs to:

  • Return a repeatable compiled template function (accepts data object)

Metadata

Metadata

Assignees

Labels

enhancementfavoriteVanity label! We like this enhancement request a lot.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions