Browse Source

chore(docs)

Ryan Chandler 5 years ago
parent
commit
d8d4c11c54
3 changed files with 14 additions and 3 deletions
  1. 2 0
      README.md
  2. 4 3
      examples/index.html
  3. 8 0
      examples/test.js

+ 2 - 0
README.md

@@ -8,6 +8,8 @@ A lightweight state management layer for Alpine.js
 
 ## Installation
 
+### CDN
+
 Include the following `<script>` tag in the `<head>` of your document:
 
 ```html

+ 4 - 3
examples/index.html

@@ -1,6 +1,7 @@
 <html>
     <head>
-        <script src="../dist/spruce.umd.js"></script>
+        <!-- <script src="../dist/spruce.umd.js"></script> -->
+        <script type="module" src="./test.js"></script>
         <script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js"></script>
     </head>
     <body>
@@ -14,10 +15,10 @@
         <div x-data x-subscribe>
             <button @click="$store.dropdown.hello = 'amazing'">Update world to amazing</button>
         </div>
-        <script>
+        <!-- <script>
             Spruce.store('dropdown', {
                 hello: 'world'
             })
-        </script>
+        </script> -->
     </body>
 </html>

+ 8 - 0
examples/test.js

@@ -0,0 +1,8 @@
+import Spruce from '../dist/spruce.module.js'
+
+Spruce.store('dropdown', {
+    hello: 'world'
+})
+
+window.Spruce = Spruce
+window.Spruce.start()