Table of contents
Edge Supercharged
Supercharge your components and use them as edge tags
Edge supercharged enables you to use your components as edge tags. It began by scanning all the templates stored inside the ./components
directory of your view root and make them available as tags.
Usage
Install the package from npm registry as follows
npm i edge-supercharged
yarn add edge-supercharged
And use it as follows
const edge = require('edge.js').default
const { Supercharged } = require('edge-supercharged')
const supercharged = new Supercharged()
edge.use(supercharged.wire, {
recurring: process.env.NODE_ENV === 'development'
})
During development, you must set the recurring
option to true, so that edge reapplies the plugin on each render call. This will allow edge-supercharged
to re-discover the components from the filesystem.
Creating components
The components must live inside the ./components
directory relative to the views directory and then you can reference your components as tags.
Instead of using the component as follows
@component('button', { type: 'submit' })
<span> Submit form </span>
@end
You can use it as follows:
@button({ type: 'submit' })
<span> Submit form </span>
@end