@combino/plugin-ejs-mate
Version:
EJS-Mate template engine plugin for Combino with layout support
104 lines (76 loc) • 1.77 kB
Markdown
EJS-Mate template engine plugin for Combino with advanced layout and block support.
```bash
npm install @combino/plugin-ejs-mate
```
```javascript
import { createCombino } from 'combino';
import ejsMatePlugin from '@combino/plugin-ejs-mate';
const combino = createCombino({
plugins: [ejsMatePlugin()],
});
// Use with your templates
await combino.generate({
templates: ['my-template'],
outputDir: './output',
});
```
- Full EJS template processing with `<%`, `<%=`, and `<%-` syntax
- Advanced layout system with explicit and dynamic layouts
- Block system for content injection and manipulation
- Support for multiple layout directories
- Automatic layout file resolution with multiple extensions
- Configurable file patterns for processing
- Supports all EJS options and features
```javascript
ejsMatePlugin({
patterns: ['*'], // Files to process
delimiter: '%',
debug: false,
// ... other EJS options
});
```
Use explicit layouts in your templates:
```ejs
<% layout('base') %>
<h1>Hello <%= name %></h1>
```
Configure layout directories in your `combino.json`:
```json
{
"layout": ["./layouts", "../shared/layouts"]
}
```
The plugin will automatically find layout files with the same name as the current file.
Define blocks in your templates:
```ejs
<% block('title') %>
Default Title
<% end %>
<% block('content') %>
<h1>Hello <%= name %></h1>
<% end %>
```
And use them in layouts:
```ejs
<!DOCTYPE html>
<html>
<head>
<title><%= block('title') %></title>
</head>
<body>
<%- body %>
<%- block('content') %>
</body>
</html>
```
MIT