Skip to content

Commit

Permalink
Fix a few typos and add setup instructions.
Browse files Browse the repository at this point in the history
Scope: bugfix, readme.
  • Loading branch information
teltploek committed Mar 16, 2017
1 parent f4ef52f commit 6cb6df1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,20 @@

Use Vash templates with Fractal.

See the Fractal [view templates guide](http://fractal.build/guide/core-concepts/views) for details on customisation and usage.
See the Fractal [view templates guide](http://fractal.build/guide/core-concepts/views) for details on customisation and usage.

## Setup

In fractal.js put in:

```
const vash = require('@pentia/fractal-vash-adapter')({
helpersName: 'html'
});
fractal.components.engine(vash);
fractal.components.set('ext', '.cshtml');
```

And you should be good to go.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pentia/fractal-vash-adapter",
"version": "1.0.0",
"version": "1.0.1",
"description": "Vash templating with Fractal",
"main": "index.js",
"scripts": {
Expand Down
16 changes: 9 additions & 7 deletions src/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ const Adapter = require('@frctl/fractal').Adapter;
class VashAdapter extends Adapter {
constructor(vash, source, app) {
super(vash, source);

this._app = app;
this.this.viewsLoaded = false;
this.source = source;
this.viewsLoaded = false;

this.loadViews(source);
}

loadViews (source) {
Expand All @@ -26,14 +29,13 @@ class VashAdapter extends Adapter {
vash.install(item.alias, item.content)
}
}
this.viewsLoaded = true;
}

render(path, str, context, meta) {
if (!this.viewsLoaded) loadViews(source);
const template = vash.compile(str);
context.cache = true;
return Promise.resolve(template(context));
const template = vash.compile(str);
context.cache = true;

return Promise.resolve(template(context));
}
}

Expand Down

0 comments on commit 6cb6df1

Please sign in to comment.