-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Came up with a simple file to use @hotwired/turbo-rails so @hotwired/turbo doesn't need imported when using rails. Tested using local turbo-morph.js file with import maps and works great. Took out all initializers and exports as I found they weren't needed. Got a good way to implement in the lib? Also should give ideas to help turbo_power-rails.
turbo-morph.js
import morphdom from "morphdom"
import { Turbo } from "@hotwired/turbo-rails"
Turbo.StreamActions.morph = function() {
const options = {
childrenOnly: this.hasAttribute("children-only")
}
this.targetElements.forEach(element => {
morphdom(element, options.childrenOnly ? this.templateContent : this.templateElement.innerHTML, options)
})
}application.js
import "@hotwired/turbo-rails"
import "turbo-morph"Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels