{"library":"stimulus-vite-helpers","title":"Stimulus Vite Helpers","type":"library","description":"stimulus-vite-helpers is a utility package designed to simplify the registration of Stimulus.js controllers within applications that utilize Vite.js as their build tool. It provides a `registerControllers` helper function, which works in conjunction with Vite's `import.meta.glob` feature to automatically discover and register controllers across your project. The current stable version is 3.1.0, and the project appears to follow a release cadence tied to new features or improvements in Stimulus or Vite ecosystems. Key differentiators include its tight integration with Vite's native glob importing, streamlining a common Stimulus setup pattern, and its origin from the Jumpstart Rails with Vite.js template, implying robust integration with Rails applications using Vite. It does not provide HMR itself but suggests `vite-plugin-stimulus-hmr` for that functionality. This library is crucial for those building modern web applications with the Stimulus framework and Vite bundler, especially in Ruby on Rails contexts where `vite_rails` is often used.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install stimulus-vite-helpers"],"cli":null},"imports":["import { registerControllers } from 'stimulus-vite-helpers'","import { Application } from 'stimulus'","const controllers = import.meta.glob('./**/*_controller.js', { eager: true })"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/ElMassimo/stimulus-vite-helpers","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/stimulus-vite-helpers","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import { Application } from 'stimulus';\nimport { registerControllers } from 'stimulus-vite-helpers';\n\n// Initialize the Stimulus application\nconst application = Application.start();\n\n// Use Vite's import.meta.glob to discover all Stimulus controllers.\n// The pattern './**/*_controller.js' will match all files ending in '_controller.js'\n// recursively from the current directory. { eager: true } ensures they are imported immediately.\nconst controllers = import.meta.glob('./**/*_controller.js', { eager: true });\n\n// Register the discovered controllers with the Stimulus application.\nregisterControllers(application, controllers);\n\nconsole.log('Stimulus application started with controllers:', Object.keys(controllers).length);","lang":"typescript","description":"Demonstrates initializing a Stimulus application and registering all controllers found via Vite's `import.meta.glob`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}