parcel-transformer-edge
v0.2.0
Published
Parcel v2 transformer plugin for Edge template
Downloads
1
Maintainers
Readme
parcel-transformer-edge
Parcel v2 transformer plugin for Edge template.
Installation
npm i -D parcel-transformer-edge
# or
yarn add -D parcel-transformer-edge
Configuration
{
"extends": ["@parcel/config-default"],
"transformers": {
"*.edge": ["parcel-transformer-edge"]
}
}
Reference Parcel 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:
module.exports = {
views: "src"
}
in template:
<!-- src/partials/header.edge -->
<header></header>
in root:
@include("partials/header")
Register template state
configuration:
module.exports = {
state: {
author: {
name: "Bob",
age: 24
}
}
};
in template:
<h1>{{ author.name }}</h1>
Result:
<h1>Bob</h1>
Register template
configuration:
module.exports = {
templates: {
button: {
template: `
<button {{ $props.serializeExcept(["title"]) }}>
{{ title }}
</button>
`
}
}
};
in template:
<div>
@!component("button", {
title: "Hello!",
class: ["Button", "Button--primary"]
})
</div>
Result:
<div>
<button class="Button Button--primary">
Hello!
</button>
</div>
Edge documentation
For more information on Edge template, see AdonisJS website.
License
MIT