Frontends
Eta
Edit on GitHubThis handler module serves Eta components with the .eta
extension.
Install
npm install @primate/eta
Configure
Import and initialize the module in your configuration.
import eta from "@primate/eta";
export default {
modules: [
eta(),
],
};
Use
Create an Eta component in components
.
<h1>All posts</h1>
<div>
<% it.posts.forEach(function(post){ %>
<h2><a href="/post/view/<%= post.id %>"><%= post.title %></a></h2>
<% }) %>
</div>
Serve it from a route.
import view from "primate/handler/view";
const posts = [{
id: 1,
title: "First post",
}];
export default {
get() {
return view("post-index.eta", { posts });
},
};
The rendered component will be accessible at http://localhost:6161/eta.
Configuration options
extension
Default ".eta"
The file extension associated with Eta components.
Resources
Previous
Angular Next
Handlebars