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: about 1 year ago
JSON representation
Parcel v2 transformer plugin for Edge template.
- Host: GitHub
- URL: https://github.com/tknf/parcel-transformer-edge
- Owner: tknf
- License: mit
- Created: 2022-03-09T18:02:08.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-12T05:01:55.000Z (over 4 years ago)
- Last Synced: 2025-02-08T17:35:39.218Z (over 1 year ago)
- Topics: html, javascript, parcel, template-engine
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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