Installation
Learn how to install Spruce in your application.
Last updated
Was this helpful?
Learn how to install Spruce in your application.
Last updated
Was this helpful?
There are 2 different ways of installing Spruce.
CDN (recommended)
NPM / Yarn
To install Spruce using a CDN, include the following <script>
tag add the end of your <body>
:
If you followed Alpine's , the Alpine script should be in the <head>
of your document, with a defer
attribute.
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.
Spruce must be included before Alpine to ensure it is initialised before Alpine.
When using this installation method, it's also recommended that you install Alpine in the same way. Visit the for Alpine for more information.