dbelyaeff / cogear.js

Modern static websites generator (Node.JS/Webpack)

Home Page:https://cogearjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't cogear.js offer partials?

joannesalfa opened this issue · comments

In order to keep the APP for changes we need a way to reuse content. Partial provides a simple interface for great flexibility and power around reusing pieces of the project

In EJS:

<h1>Hello</h1>
<%- partial("_menu") %>
<body>...</body>

Partial directory:

/project/partials/_menu.ejs

Hi, @joannesalfa!

Yes, it does in layouts.

You can specify relative path to partial from a layout template.

/themes/default

.
├── README.md
├── layouts
│   ├── index.ejs
│   └── test.ejs
├── package.json
├── resources
│   └── favicon.png
├── screenshot.jpg
├── style.styl
└── theme.js

index.ejs

<!doctype html>
<html class="no-js" lang="">

<head>
  <title><%- title %></title>
</head>

<body>
	<%- content %>
	<%- include test.ejs %>
</body>

</html>

test.ejs

Hello!