Installation
Learn how to install Spruce in your application.
Methods
There are 2 different ways of installing Spruce.
CDN (recommended)
NPM / Yarn
NPM (recommended)
To install Spruce using a CDN, include the following <script>
tag add the end of your <body>
:
If you followed Alpine's installation instructions, the Alpine script should be in the <head>
of your document, with a defer
attribute.
You do not need to manually initalise Spruce when installing it via the CDN.
NPM / Yarn
To install Spruce using NPM / Yarn, run the following command inside of your project:
Inside of your JavaScript file, add the following code:
Transpile your JavaScript file and include it in your page.
When using this installation method, it's also recommended that you install Alpine in the same way. Visit the installation instructions for Alpine for more information.
Spruce must be included before Alpine to ensure it is initialised before Alpine.
Last updated