egg-view-arttemplate
egg view plugin for arttemplate.
Install
$ npm i egg-view-arttemplate --save
Usage
// {app_root}/config/plugin.jsexportsarttemplate = enable: true package: 'egg-view-arttemplate'; // {app_root}/config/config.default.jsexportsview = mapping: '.html': 'arttemplate' ; // arttemplate configexportsarttemplate = escape: true debug: false bail: true cache: true;
Create a arttemplate file
// app/view/hello.arttemplatehello <%= data %>
Render it
// app/controller/render.jsexportsarttemplate = async { await ctx;};
Layout
You can render a view with layout also:
// app/view/layout.htmleach target $index $value/each // app/controller/render.jsexportsarttemplate = async { const locals = data: 'world' target: 1 2 3 ; const viewOptions = cache: false ; await ctx;};
Configuration
see config/config.default.js for more detail.
Questions & Suggestions
Please open an issue here.