Reader small image

You're reading from  Building SPAs with Django and HTML Over the Wire

Product typeBook
Published inAug 2022
PublisherPackt
ISBN-139781803240190
Edition1st Edition
Tools
Right arrow
Author (1)
Andros Fenollosa
Andros Fenollosa
author image
Andros Fenollosa

Andros Fenollosa is a custom programming expert that works as a teacher, full stack developer, and mobile developer. He's a Web Designer, Web Programmer, and Apps Programmer, among other things ( PWA, Android and iOS ). He has a plethora of commercial expertise, having worked on projects in a variety of locales throughout the world.
Read more about Andros Fenollosa

Right arrow

Installing and configuring Stimulus

Before you can use Stimulus, you will need to download and install the framework. If you don’t want to complicate things, you can import it from its CDN. Just add the following script in the HTML template:

<script type="module" src=
https://unpkg.com/@hotwired/stimulus@3.0.1/dist/stimulus.js
> 

If you opt for this solution, you can ignore the rest of this section.

However, if you want to download Stimulus, which is very good practice, please note that it is available in the npm packages, so let’s install it with a command:

npm i @hotwired/stimulus

From here, you have three different configuration possibilities: using Webpack, using another build system, or using the native JavaScript module system. We are going to focus on the last option, using modules, to simplify your implementation and not add more complexity:

  1. Copy the Stimulus file to a folder inside static, for example, in the static/js...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Building SPAs with Django and HTML Over the Wire
Published in: Aug 2022Publisher: PacktISBN-13: 9781803240190

Author (1)

author image
Andros Fenollosa

Andros Fenollosa is a custom programming expert that works as a teacher, full stack developer, and mobile developer. He's a Web Designer, Web Programmer, and Apps Programmer, among other things ( PWA, Android and iOS ). He has a plethora of commercial expertise, having worked on projects in a variety of locales throughout the world.
Read more about Andros Fenollosa