Socket
Socket
Sign inDemoInstall

ecto

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecto - npm Package Compare versions

Comparing version 0.9.9 to 1.0.0

2

dist/baseEngine.d.ts
export declare class BaseEngine {
private __extensions;
name: string;
names: string[];
opts?: any;

@@ -5,0 +5,0 @@ engine: any;

@@ -7,3 +7,3 @@ "use strict";

this.__extensions = Array();
this.name = "";
this.names = Array();
this.opts = undefined;

@@ -10,0 +10,0 @@ this.rootTemplatePath = undefined;

@@ -6,8 +6,8 @@ "use strict";

let be = new baseEngine_1.BaseEngine();
expect(be.name).toBe("");
expect(be.names.toString()).toBe("");
});
test("BaseEngine - Default Name should be Foo", () => {
let be = new baseEngine_1.BaseEngine();
be.name = "foo";
expect(be.name).toBe("foo");
be.names = ["foo"];
expect(be.names.toString()).toBe("foo");
});

@@ -14,0 +14,0 @@ test("BaseEngine - Opts should be undefined", () => {

@@ -7,3 +7,2 @@ import { EngineMap } from "./engineMap";

import { Nunjucks } from "./engines/nunjucks";
import { Mustache } from "./engines/mustache";
import { Liquid } from "./engines/liquid";

@@ -18,3 +17,2 @@ export declare class Ecto {

private __nunjucks;
private __mustache;
private __handlebars;

@@ -30,3 +28,2 @@ private __liquid;

get nunjucks(): Nunjucks;
get mustache(): Mustache;
get handlebars(): Handlebars;

@@ -33,0 +30,0 @@ get liquid(): Liquid;

@@ -10,3 +10,2 @@ "use strict";

const nunjucks_1 = require("./engines/nunjucks");
const mustache_1 = require("./engines/mustache");
const liquid_1 = require("./engines/liquid");

@@ -24,3 +23,2 @@ const fs = require("fs-extra");

this.__nunjucks = new nunjucks_1.Nunjucks();
this.__mustache = new mustache_1.Mustache();
this.__handlebars = new handlebars_1.Handlebars();

@@ -33,3 +31,2 @@ this.__liquid = new liquid_1.Liquid();

this.__engines.push(this.__nunjucks);
this.__engines.push(this.__mustache);
this.__engines.push(this.__handlebars);

@@ -71,5 +68,2 @@ this.__engines.push(this.__liquid);

}
get mustache() {
return this.__mustache;
}
get handlebars() {

@@ -146,3 +140,5 @@ return this.__handlebars;

this.__engines.forEach(eng => {
this.__mapping.set(eng.name, eng.getExtensions());
eng.names.forEach(name => {
this.__mapping.set(name, eng.getExtensions());
});
});

@@ -163,3 +159,3 @@ }

case "mustache":
result = this.__mustache;
result = this.__handlebars;
break;

@@ -166,0 +162,0 @@ case "handlebars":

@@ -52,31 +52,32 @@ "use strict";

let ecto = new ecto_1.Ecto();
expect((_a = ecto.mappings.get("handlebars")) === null || _a === void 0 ? void 0 : _a.length).toBe(3);
expect((_a = ecto.mappings.get("handlebars")) === null || _a === void 0 ? void 0 : _a.length).toBe(4);
});
test("Mustache should be registered", () => {
var _a;
let ecto = new ecto_1.Ecto();
expect((_a = ecto.mappings.get("mustache")) === null || _a === void 0 ? void 0 : _a.length).toBe(4);
});
test("EJS is valid instance", () => {
let ecto = new ecto_1.Ecto();
expect(ecto.ejs.name).toBe("ejs");
expect(ecto.ejs.names.toString()).toContain("ejs");
});
test("markdown is valid instance", () => {
let ecto = new ecto_1.Ecto();
expect(ecto.markdown.name).toBe("markdown");
expect(ecto.markdown.names.toString()).toContain("markdown");
});
test("pug is valid instance", () => {
let ecto = new ecto_1.Ecto();
expect(ecto.pug.name).toBe("pug");
expect(ecto.pug.names.toString()).toContain("pug");
});
test("nunjucks is valid instance", () => {
let ecto = new ecto_1.Ecto();
expect(ecto.nunjucks.name).toBe("nunjucks");
expect(ecto.nunjucks.names.toString()).toContain("nunjucks");
});
test("mustache is valid instance", () => {
let ecto = new ecto_1.Ecto();
expect(ecto.mustache.name).toBe("mustache");
});
test("handlebars is valid instance", () => {
let ecto = new ecto_1.Ecto();
expect(ecto.handlebars.name).toBe("handlebars");
expect(ecto.handlebars.names.toString()).toContain("handlebars");
});
test("liquid is valid instance", () => {
let ecto = new ecto_1.Ecto();
expect(ecto.liquid.name).toBe("liquid");
expect(ecto.liquid.names.toString()).toContain("liquid");
});

@@ -101,3 +102,3 @@ test("isValidEngine should return true", () => {

let ecto = new ecto_1.Ecto();
expect(ecto.getRenderEngine("cool").name).toBe("ejs");
expect(ecto.getRenderEngine("cool").names.toString()).toBe("ejs");
});

@@ -107,3 +108,3 @@ test("getRenderEngine should return valid for each", () => {

engines.forEach(engine => {
expect(ecto.getRenderEngine(engine).name).toBe(engine);
expect(ecto.getRenderEngine(engine).names.toString()).toContain(engine);
});

@@ -110,0 +111,0 @@ });

interface EngineInterface {
name: string;
names: Array<string>;
engine: any;

@@ -4,0 +4,0 @@ opts?: any;

@@ -9,3 +9,3 @@ "use strict";

super();
this.name = "ejs";
this.names = ["ejs"];
if (opts) {

@@ -12,0 +12,0 @@ this.opts = opts;

@@ -11,3 +11,3 @@ "use strict";

let engine = new ejs_1.EJS();
expect(engine.name).toBe("ejs");
expect(engine.names.toString()).toContain("ejs");
});

@@ -14,0 +14,0 @@ test("EJS - Opts should be undefined by default", () => {

@@ -12,6 +12,6 @@ "use strict";

this.partialsPath = "/partials";
this.name = "handlebars";
this.names = ["handlebars", "mustache"];
this.opts = opts;
this.engine = handlebars;
this.setExtensions(["hbs", "hjs", "handlebars"]);
this.setExtensions(["hbs", "hjs", "handlebars", "mustache"]);
}

@@ -33,3 +33,3 @@ async render(source, data) {

let source = fs.readFileSync(partialsPath + "/" + p).toString();
let name = p.split(".hjs")[0];
let name = p.split(".")[0];
if (handlebars.partials[name] === undefined) {

@@ -36,0 +36,0 @@ handlebars.registerPartial(name, handlebars.compile(source));

@@ -11,3 +11,3 @@ "use strict";

let engine = new handlebars_1.Handlebars();
expect(engine.name).toBe("handlebars");
expect(engine.names.toString()).toContain("handlebars");
});

@@ -25,3 +25,3 @@ test("Handlebars - Opts should be undefined by default", () => {

let engine = new handlebars_1.Handlebars();
expect(engine.getExtensions().length).toBe(3);
expect(engine.getExtensions().length).toBe(4);
});

@@ -54,3 +54,4 @@ test("Handlebars - Rendering a simple string", async () => {

expect(await engine.render(source, exampleData1)).toContain("Alan's - Header Title");
expect(await engine.render(source, exampleData1)).toContain("Foo!");
});
//# sourceMappingURL=handlebars.test.js.map

@@ -9,3 +9,3 @@ "use strict";

super();
this.name = "liquid";
this.names = ["liquid"];
if (opts) {

@@ -12,0 +12,0 @@ this.opts = opts;

@@ -12,3 +12,3 @@ "use strict";

let engine = new liquid_1.Liquid();
expect(engine.name).toBe("liquid");
expect(engine.names.toString()).toContain("liquid");
});

@@ -15,0 +15,0 @@ test("Liquid - Opts should be undefined by default", () => {

@@ -8,3 +8,3 @@ "use strict";

super();
this.name = "markdown";
this.names = ["markdown"];
if (opts) {

@@ -11,0 +11,0 @@ this.opts = opts;

@@ -8,3 +8,3 @@ "use strict";

let engine = new markdown_1.Markdown();
expect(engine.name).toBe("markdown");
expect(engine.names.toString()).toContain("markdown");
});

@@ -11,0 +11,0 @@ test("Markdown - Opts should be undefined by default", () => {

@@ -9,3 +9,3 @@ "use strict";

super();
this.name = "nunjucks";
this.names = ["nunjucks"];
this.engine = nunjucks;

@@ -12,0 +12,0 @@ this.opts = { autoescape: true }; //default opts

@@ -12,3 +12,3 @@ "use strict";

let engine = new nunjucks_1.Nunjucks();
expect(engine.name).toBe("nunjucks");
expect(engine.names.toString()).toContain("nunjucks");
});

@@ -15,0 +15,0 @@ test("Nunjucks - Opts should be set by", () => {

@@ -9,3 +9,3 @@ "use strict";

super();
this.name = "pug";
this.names = ["pug"];
this.engine = pug;

@@ -12,0 +12,0 @@ if (opts) {

@@ -12,3 +12,3 @@ "use strict";

let engine = new pug_1.Pug();
expect(engine.name).toBe("pug");
expect(engine.names.toString()).toContain("pug");
});

@@ -15,0 +15,0 @@ test("Pug - Opts should be undefined by default", () => {

{
"name": "ecto",
"version": "0.9.9",
"version": "1.0.0",
"description": "Modern Template Consolidation Engine for EJS, Markdown, Pug, Nunjucks, and Handlebars",

@@ -45,3 +45,2 @@ "main": "./dist/ecto.js",

"marked": "^2.0.1",
"mustache": "^4.1.0",
"nunjucks": "^3.2.3",

@@ -48,0 +47,0 @@ "pug": "^3.0.2",

@@ -14,6 +14,6 @@ ![Ecto](ecto_logo.png "Ecto")

## Features
* Zero Config by default but all properties exposed for flexibility. Check out our easy [API](#api)
* Zero Config by default but all properties exposed for flexibility. Check out our easy [API.](#api)
* Async `render` and `renderFromFile` functions for ES6 and Typescript.
* [Render via Template File](#render-from-file) with Automatic Engine Selection. No more selecting which engine to use as it does it for you based on file extension.
* [Only the Top Template Engines](#only-the-top-template-engines-and-their-extensions): EJS, Markdown, Pug, Nunjucks, Mustache, Liquid, and Handlebars
* [Render via Template File](#render-from-file) with Automatic Engine Selection. No more selecting which engine to use, engine choice is automatically decided based on the file extension.
* [Only the Top Template Engines](#only-the-top-template-engines-and-their-extensions): EJS, Markdown, Pug, Nunjucks, Mustache, Liquid, and Handlebars.
* Maintained with Monthly Updates!

@@ -25,42 +25,76 @@

Step 1: Add Ecto to your Project
Follow these steps to add Ecto to a new or existing JavaScript project:
1. Ensure Node.js is installed. For macOS and Linux, you can install Node.js in the terminal using Homebrew:
```
brew install node
```
The [Node.js package manager documentation](https://nodejs.org/en/download/package-manager/) provides the commands needed to complete the install on Windows and other operating systems.
2. Open the terminal for your project and run `npm install ` to ensure all project dependencies are correctly installed.
```
npm install
```
3. Add Ecto to your Project. `yarn` is a package manager you can learn about [here.](https://yarnpkg.com/)
```
yarn add ecto
```
Step 2: Declate and Initialize
4. Declare and Initialize.
```javascript
const Ecto = require("ecto");
const Ecto = require("ecto").Ecto;
let ecto = new Ecto();
```
Step 3: Render via String for EJS ([Default Engine](#default-engine))
OR
```javascript
const ecto = require("ecto").create();
```
5. Render via String for EJS ([Default Engine](#default-engine))
```javascript
let source = "<h1>Hello <%= firstName%> <%= lastName %>!</h1>";
let data = {firstName: "John", lastName: "Doe"}
//async render(source:string, data?:object, engineName?:string, rootTemplatePath?:string, filePathOutput?:string): Promise<string>
let output = await ecto.render(source, data);
ecto.render(source, data).then((output) => {
console.log(output);
});
```
Here is how it looks all together after you have added it as a package via `yarn add ecto`! Here we also set a different [defaultEngine](#default-engine).
After running your program you should be greeted by the following output:
```
<h1>Hello John Doe!</h1>
```
------
You can easily set a different [defaultEngine](#default-engine), here we use Handlebars.
```javascript
const Ecto = require("ecto");
let ecto = new Ecto({defaultEngine: "handlebars"});
let ecto = require("ecto").create({defaultEngine: "handlebars"});
let source = "<h1>Hello {{ firstName }} {{ lastName }}!</h1>";
let data = {firstName: "John", lastName: "Doe"};
let output = await ecto.render(source, data);
console.log(output);
ecto.render(source, data).then((output) => {
console.log(output);
});
```
To render from a template file it just use the `renderFromFile` function. This does automatic selection of the engine based on file extension.
To render from a template file, Ecto uses the `renderFromFile` function. This performs an automatic selection of the engine based on the file extension.
```javascript
let ecto = new Ecto();
let ecto = require("ecto").create();
let data = { firstName: "John", lastName: "Doe"};
//async renderFromFile(filePath:string, data?:object, rootTemplatePath?:string, filePathOutput?:string, engineName?:string): Promise<string>
let output = await ecto.renderFromFile("./path/to/template.ejs", data);
ecto.renderFromFile("./path/to/template.ejs", data).then((output) => {
console.log(output)
});
```

@@ -75,3 +109,3 @@

* [Learn more about Markdown](#markdown)
* [Learn more about Handlebars and Helpers that we added](#handlebars)
* [Learn more about Handlebars / Mustache and Helpers that we added](#handlebars)

@@ -82,5 +116,5 @@ -----

While doing research for enabling other projects to handle multiple template engines we decided to not use other consolidation engines as they were all over the place. Some of the packages were unsupported and most likely hard to validate as working. Some had had limited types and ease of use.
We decided to focus on the most popular and well-maintained consolidation engines. Unfortunately other engines suffered from packages that were unsupported, making it difficult to validate them as working fully. Some engines also had limited types and lacked ease of use.
Our goal is to support the top engines which most likely handle the vast majority of use cases and just make it easy. Here are the top engines that we support and make easy:
Our goal is to support the top engines, handling the vast majority of use cases. Here are the top engines that we support:

@@ -103,50 +137,52 @@ | Engine | Monthly Downloads | Extensions |

As we have shown in [Getting Started -- It's that Easy!](#getting-started) you can do a render in only a couple lines of code:
As we have shown in [Getting Started -- It's that Easy!](#getting-started) You can render in only a couple of lines of code:
```javascript
let ecto = new Ecto();
let ecto = require("ecto").create();
let source = "<h1>Hello <%= firstName%> <%= lastName %>!</h1>";
let data = {firstName: "John", lastName: "Doe"};
let output = await ecto.render(source, data);
console.log(output);
ecto.render(source, data).then((output) => {
console.log(output);
});
```
Now lets say your engine is not [EJS](https://www.npmjs.com/package/ejs) so you want to specify it. You can either set the [defaultEngine](#default-engine) parameter or simply pass it in the `render` function. Here we are doing [Handlebars](https://www.npmjs.com/package/handlebars):
Now let's say your desired engine is not [EJS](https://www.npmjs.com/package/ejs), so you want to specify it explicitly. You can either set the [defaultEngine](#default-engine) parameter, or simply pass it in the `render` function. In this case with the popular engine, [Handlebars](https://www.npmjs.com/package/handlebars):
```javascript
let ecto = new Ecto();
let ecto = require("ecto").create();
let source = "<h1>Hello {{firstName}} {{lastName}}!</h1>";
let data = {firstName: "John", lastName: "Doe"};
let output = await ecto.render(source, data, "handlebars");
let data = {firstName: "John", lastName: "Doe"}
ecto.render(source, data, "handlebars").then((output) => {
console.log(output);
});
console.log(output);
```
`render` also can handle partial files for you standard engines (markdown excluded) by just adding the `rootTemplatePath`:
The `render` function also can handle partial files for standard engines (markdown excluded) by simply adding the `rootTemplatePath`:
```javascript
let ecto = new Ecto();
let ecto = require("ecto").create();
let source = "<h1>Hello <%= firstName%> <%= lastName %>!</h1><%- include('/relative/path/to/partial'); %>";
let data = {firstName: "John", lastName: "Doe"};
let output = await ecto.render(source, data, undefined, "./path/to/templates");
ecto.render(source, data, undefined, "./path/to/templates").then((output) => {
console.log(output);
});
console.log(output);
```
`render` also can write out the file for you by specifying the `filePathOutput` parameter like below. It will still return the output via `string`:
With `render` you can also write to a file. This is accomplished by specifying the `filePathOutput` parameter as below. It will still return the output as a `string`:
```javascript
let ecto = new Ecto();
let ecto = require("ecto").create();
let source = "<h1>Hello <%= firstName%> <%= lastName %>!</h1>";
let data = {firstName: "John", lastName: "Doe"};
let output = await ecto.render(source, data, undefined, undefined, "./path/to/output/file.html");
console.log(output);
ecto.render(source, data, undefined, undefined, "./path/to/output/file.html").then((output) => {
console.log(output);
});
```
Notice the `undefined` passed into the `engineName` parameter. This is done because we already have the [defaultEngine](#default-engine) set to [EJS](https://www.npmjs.com/package/ejs). If you want you can easily add it in by specifying it.
Notice the `undefined` value passed into the `engineName` parameter. This is done because we already have the [defaultEngine](#default-engine) set to [EJS](https://www.npmjs.com/package/ejs). If you want you can easily add it in here too.

@@ -157,37 +193,33 @@ -----

To render via a template file it is as simple as calling the `renderFromFile` function with a couple simple parameters to be passed in. In this example we are simply passing in the template and it will return a `string`.
To render via a template file, it is as simple as calling the `renderFromFile` function with a couple of simple parameters passed in. In this example, we are passing in the template and it will return a `string`.
_One of the biggest benefits is that based on the file extension it will automatically select the correct engine._
_One of the main benefits is that it will automatically select the correct engine based on the file extension._
```javascript
let ecto = new Ecto();
let ecto = require("ecto").create();
let data = { firstName: "John", lastName: "Doe"};
let output = await ecto.renderFromFile("./path/to/template.ejs", data);
ecto.renderFromFile("./path/to/template.ejs", data).then((output) => {console.log(output)});
```
In this example we are now asking it to write the output file for us and it will return the output still as a `string`:
In this example, we are writing the output to a HTML file:
```javascript
let ecto = new Ecto();
let ecto = require("ecto").create();
let data = { firstName: "John", lastName: "Doe"};
let output = await ecto.renderFromFile("./path/to/template.ejs", data, undefined,"./path/to/output/yourname.html");
ecto.renderFromFile("./path/to/template.ejs", data, undefined, "./path/to/output/yourname.html")
```
Notice that in these examples it is using the `./path/to/template.ejs` to use the engine [EJS](https://www.npmjs.com/package/ejs) for the rendering.
Notice that in these examples it is using the `./path/to/template.ejs` to specify [EJS](https://www.npmjs.com/package/ejs) for the rendering.
You can override the auto selected engine by adding it on the function as a parameter by passing in `pug` in this example:
You can override the auto-selected engine by passing in the string value of a template engine as a parameter into the `renderFromFile` function. We pass in `pug`, which states we want to render the template using the [Pug](https://www.npmjs.com/package/pug) engine.
```javascript
let ecto = new Ecto();
let ecto = require("ecto").create();
let data = { firstName: "John", lastName: "Doe"};
let output = await ecto.renderFromFile("./path/to/template.ejs", data, undefined, "./path/to/output/yourname.html", "pug");
ecto.renderFromFile("./path/to/template.ejs", data, undefined,
"./path/to/output/yourname.html", "pug")
```
This will override the auto selection process and render the template using the [Pug](https://www.npmjs.com/package/pug) engine.
-----

@@ -197,12 +229,13 @@

There are a couple of ways to set the default engine to make it flexible. The first is that the `Ecto.defaultEngine` is set by default to `ejs`. So if you are using `ejs` no need to change anything.
There are several ways to set the default engine to make it flexible. `Ecto.defaultEngine` is set by default to `ejs`, so if you are using `ejs` no need to change anything.
Here is how you set it on initializing your class with `liquid` as the default engine:
Here is how you set `liquid` as the default engine while initializing your class:
```javascript
let ecto = new Ecto({defaultEngine: "liquid"});
let ecto = require("ecto").create({defaultEngine: "liquid"});
```
Here is how you set it as a parameter:
Or you can set the default engine as a parameter like so:
```javascript
const Ecto = require("ecto").Ecto;
let ecto = new Ecto();

@@ -213,10 +246,12 @@ ecto.defaultEngine = "mustache";

You can also do it on the `render` which will override the `Ecto.defaultEngine` parameter:
You can also set the engine as a parameter on the `render` function, which will override the `Ecto.defaultEngine` parameter:
```javascript
let ecto = new Ecto();
let ecto = require("ecto").create();
let source = "<h1>Hello {{firstName}} {{lastName}}!</h1>";
let data = {firstName: "John", lastName: "Doe"};
let output = await ecto.render(source, data, "handlebars");
ecto.render(source, data, "handlebars").then((output) => {
console.log(output);
});
```

@@ -230,3 +265,6 @@

let output = await ecto.renderFromFile("./path/to/template.html", data, undefined, "./path/to/output/yourname.html", "pug");
ecto.renderFromFile("./path/to/template.ejs", data, undefined,
"./path/to/output/yourname.html", "pug").then((output) => {
console.log(output)
});
```

@@ -237,3 +275,3 @@ ## Examples By Specific Engines

Markdown is a bit different as it will not have some of the complexities such as `data` objects or partials and layouts. To render markdown it is this easy:
Markdown does not contain complexities such as data objects, or partials and layouts. To render markdown its as simple as:

@@ -243,13 +281,13 @@ ```javascript

let source = "# markdown rulezz!";
let output = await ecto.render(source, undefined, "markdown");
console.log(output); //should be <h1 id="markdown-rulezz">markdown rulezz!</h1>
ecto.render(source, undefined, "markdown").then((output) => {
console.log(output) //should be <h1 id="markdown-rulezz">markdown rulezz!</h1>
});
```
Render by File
Render by Markdown file:
```javascript
let ecto = Ecto();
let output = await ecto.renderByFile("/path/to/file.md");
console.log(output);
ecto.renderByFile("/path/to/file.md").then((output) => {
console.log(output)
});
```

@@ -269,14 +307,17 @@

```
You can read more about them by going [here](https://marked.js.org/using_advanced#options).
You can read more about them [here](https://marked.js.org/using_advanced#options).
### Handlebars
Handlebars is a favorite of ours but it needs a bit more help to really get the bang for the buck. To do that we added in [handlebars-helpers](https://www.npmjs.com/package/hanldebars-helpers) to do the trick so you can format dates and more. Here is an example using `Handlebars Helpers` in your template:
In Ecto we use the [handlebars](https://www.npmjs.com/package/handlebars-helpers) engine to render `mustache` related templates. This is because handlebars is based on mustache with just more additional features.
Handlebars is a fantastic template engine, and we've incorporated helpers to make it even better. We added in [handlebars-helpers](https://www.npmjs.com/package/handlebars-helpers) so you can format dates, and more. Here is an example using `Handlebars Helpers` in your template:
```javascript
let ecto = Ecto();
let source = "{{year}}";
let output = await ecto.render(source, undefined, "handlebars");
console.log(output); //should be current year such as 2021
ecto.render(source, undefined, "handlebars").then((output) => {
console.log(output)
});
```

@@ -292,3 +333,3 @@

```javascript
const Ecto = require("Ecto");
const Ecto = require("Ecto").Ecto;

@@ -303,16 +344,16 @@ let ecto = new Ecto();

* render (`async`) - Render from a string.
* source:string - the markup/template source that you would like to render
* source?:string - the markup/template source that you would like to render
* data?:object - data to be rendered by the file
* engineName?:string - to override the `Ecto.defaultEngine` parameter
* rootTemplatePath?:string - root template path that is used for `patials` and `layouts`
* filePathOutput?:string - specify the file path if you would like to write out the rendered output.
* renderFromFile (`async`) - Render from a file path and will auto select what engine to use based off of extension. It will return a `Promise<string>` of the rendered output.
* rootTemplatePath?:string - root template path that is used for `partials` and `layouts`
* filePathOutput?:string - to specify the file path if you want to write the rendered output to a file
* renderFromFile (`async`) - Renders from a file path and will auto-select what engine to use based on the file extension. It will return a `Promise<string>` of the rendered output.
* filePath?:string - the file that you would like to render
* data?:object - data to be rendered by the file
* rootTemplatePath?:string - root template path that is used for `patials` and `layouts`
* filePathOutput?:string - specify the file path if you would like to write out the rendered output.
* engineName?:string - to override the auto selection of the engineName
* rootTemplatePath?:string - root template path that is used for `partials` and `layouts`
* filePathOutput?:string - to specify the file path if you want to write the rendered output to a file
* engineName?:string - to override the auto-selection of the engineName
### Parameters:
* defaultEngine:string = the default engine to use and set by default to `ejs`
* defaultEngine:string - the default engine to use and set by default to `ejs`
* mappings:EngineMap - Mapping class of all the engines registered in the system.

@@ -322,3 +363,3 @@

To make it easier to access certain engines and change them all engines supported are provided as parameters directly on the `Ecto` class as `Ecto.<EngineFullName>` such as:
To make it easier to access and change between engines, all supported engines are provided as parameters on the `Ecto` class as `Ecto.<EngineFullName>`
```javascript

@@ -330,6 +371,34 @@ let ecto = Ecto();

To access the specific engine you can do so by going to `ecto.<engine_name>.engine` such as setting the [SafeString](https://handlebarsjs.com/api-reference/utilities.html#handlebars-safestring-string):
To access a specific engine you can do so by going to `ecto.<engine_name>.engine` and setting the [SafeString](https://handlebarsjs.com/api-reference/utilities.html#handlebars-safestring-string):
```javascript
let ecto = Ecto();
ecto.Handlebars.engine.SafeString("<div>HTML Content!</div>");
```
```
------
### How to Contribute
This is an open-source project under MIT License. If you would like to get involved and contribute to this project, simply follow these steps:
1. Create a fork of this project, this will act as your copy of a GitHub repository allowing you to make changes to code without affecting the original project.
2. Clone this fork to create a local repository.
3. Make the desired changes to your copy of the project, commit, and push those changes when ready.
4. Finally, create a pull request to suggest your changes to the original project.
#### Pull Requests
Pull requests are used in open-source projects or in some corporate workflows to manage changes from contributors and to initiate code review before such changes are merged.
By creating a pull request, you tell others about the changes you've pushed to your fork of a GitHub repository, so that the maintainers of the original repository can review your changes, discuss them, and integrate them into the base branch.
------
### How to Submit an Issue
Issues can be used to keep track of bugs, enhancements, or other requests. Issues can be created based on code from pull requests, comments, or created from the main repository page.
1. Navigate to the [main page for this repository.](https://github.com/jaredwray/ecto)
2. Under the repository name, jaredwray/ecto, click the "Issues" tab.
3. Click New Issue.
4. Enter the title and description for your issue, and click "Submit new issue".

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc