Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tknf/parcel-transformer-edge

Parcel v2 transformer plugin for Edge template.
https://github.com/tknf/parcel-transformer-edge

html javascript parcel template-engine

Last synced: 8 days ago
JSON representation

Parcel v2 transformer plugin for Edge template.

Awesome Lists containing this project

README

        

# parcel-transformer-edge
Parcel v2 transformer plugin for Edge template.

## Installation
```sh
npm i -D parcel-transformer-edge
# or
yarn add -D parcel-transformer-edge
```

## Configuration
```json
{
"extends": ["@parcel/config-default"],
"transformers": {
"*.edge": ["parcel-transformer-edge"]
}
}
```

Reference [Parcel plugin configuration](https://v2.parceljs.org/configuration/plugin-configuration/)

## Customization
You can add custom options for Edge templating engine using a `.edgerc.js`, `edge.config.js` file.

### Set views directory

You can register a path to directory for finding the Edge templates.
Default: `views`

configuration:
```js
module.exports = {
views: "src"
}
```

in template:
```html

```

in root:
```html
@include("partials/header")
```

### Register template state

configuration:
```js
module.exports = {
state: {
author: {
name: "Bob",
age: 24
}
}
};
```

in template:
```html

{{ author.name }}


```

Result:
```html

Bob


```

### Register template

configuration:
```js
module.exports = {
templates: {
button: {
template: `

{{ title }}

`
}
}
};
```

in template:
```html


@!component("button", {
title: "Hello!",
class: ["Button", "Button--primary"]
})

```

Result:
```html



Hello!


```

## Edge documentation

For more information on Edge template, see [AdonisJS website](https://docs.adonisjs.com/guides/views/rendering).

## License
MIT