We are going to use the pre-compiled, optimized NPM package from skypack.dev using the <script>
tag, just like it's 2007. For other installation methods, check out the Installing Turbo documentation.
Step 1: Add the following script
tag just above the <title>
tag in your HTML.
<script type="module">
import * as Turbo from 'https://cdn.skypack.dev/@hotwired/turbo@7.1.0';
</script>
<title>Wireframe</title>
Step 2: There's no step 2. 😉
If you're curious about how the above snippet works, I highly recommend you read the MDN documentation on JavaScript Modules.
That's it. Our little website is using Turbo.
To verify, reload the browser, open the DevTools window, go to the Console
tab, and type Turbo
in it. If it doesn't throw an error, you're good to go.
Now that we've successfully installed Turbo, we're ready to use it. We'll start with the first big component in Turbo, called Turbo Drive.