Sha256: 6bcf53d7ac3114445ae47cbd7244c687329c49094f75e299250c998ecc0337b4
Contents?: true
Size: 625 Bytes
Versions: 5
Compression:
Stored size: 625 Bytes
Contents
// Experimental: Not currently exposed. import { Application } from "stimulus" const application = Application.start() async function preloadControllers() { const imports = await fetch("<%= asset_path "importmap.json" %>").then(r => r.json()).then(json => json.imports) for (const name in imports) { if (name.startsWith("controllers/")) { let controllerName = name.replace(/controllers\//, "").replace("_controller", "") import(imports[name]).then((module) => { application.register(controllerName, module.default) }).catch(error => console.log(error)) } } } preloadControllers()
Version data entries
5 entries across 5 versions & 2 rubygems