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>
:
<script src="https://cdn.jsdelivr.net/npm/@ryangjchandler/[email protected]/dist/spruce.umd.js"></script>
If you followed Alpine's installation instructions, the Alpine script should be in the <head>
of your document, with a defer
attribute.
NPM / Yarn
To install Spruce using NPM / Yarn, run the following command inside of your project:
npm install @ryangjchandler/spruce
yarn add @ryangjchandler/spruce
Inside of your JavaScript file, add the following code:
import '@ryangjchandler/spruce'
Transpile your JavaScript file and include it in your page.
Spruce must be included before Alpine to ensure it is initialised before Alpine.
Last updated
Was this helpful?