1.0.0 • Published 5 years ago

stimulus-jolt v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

stimulus-jolt

Jolt is a simple view rendering library for Stimulus to supercharge your targets. Instead of writing code like this:

this.nameTarget.textContent = "ACME Widgets, Inc."
this.nameTarget.classList.add('text-bold')
this.nameTarget.dataset.id = 25
this.descriptionTarget.innerHTML = descriptionValue

You can write code like this:

this.renderTargets({
  name: [
    "ACME Widgets, Inc.",
    {class: 'text-bold', toggle: true},
    {data: 'id', value: 25}
  ],
  description: {html: descriptionValue}
})

In addition, you can tell Jolt to render an HTML template into your controller element automatically, and it also supports transformation callbacks so text or HTML content can be modified by your controller before it flows into the target.