Installing Strada in Your Application
Strada can either be referenced in compiled form via the Strada distributable script directly in the <head>
of your application, or through npm via a bundler like esbuild.
﹟ Prerequisite: Install Stimulus
Strada leverages Stimulus and the core BridgeComponent
class is an extension of a Stimulus Controller
. You must have Stimulus installed in your web app before installing Strada. See the Stimulus installation instructions.
﹟ In Compiled Form
If you’re using importmap-rails you just need to pin Stimulus and Strada in your config/importmap.rb file:
./bin/importmap pin @hotwired/stimulus @hotwired/strada
Alternatively, you can manually define importmap entries for both Strada and Stimulus, pointing to the latest versions of each:
<head>
<script type="importmap">
{
"imports": {
"@hotwired/stimulus": "https://cdn.jsdelivr.net/npm/@hotwired/stimulus@latest/dist/stimulus.min.js",
"@hotwired/strada": "https://cdn.jsdelivr.net/npm/@hotwired/strada@latest/dist/strada.min.js"
}
}
</script>
</head>
Then you can import Strada anywhere in your application code:
import { BridgeComponent } from "@hotwired/strada"
class BridgeTest extends BridgeComponent {
// ...
}
﹟ As An npm Package
You can install Strada from npm via the npm
or yarn
packaging tools and use a JavaScript bundler, like webpack or esbuild, to import it in your application.
import "@hotwired/strada"
Installing Strada in Your Native Apps
Dedicated installation instructions are provided for the iOS and Android libraries in their GitHub repos.