Skip to content

Commit

Permalink
Use es module shims in docs for Safari/Firefox compatibility (#105)
Browse files Browse the repository at this point in the history
* add es module shims

* Enable json modules with shim

* Set options before shims

* Remove comment from importmap json
  • Loading branch information
excid3 authored Oct 4, 2021
1 parent fc99b33 commit 7727f3a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 8 additions & 2 deletions docs/alert.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<title>Tailwind Stimulus Components</title>
<link href="https://unpkg.com/[email protected]/dist/tailwind.min.css" rel="stylesheet">
<link href="https://unpkg.com/@tailwindcss/[email protected]/dist/forms.min.css" rel="stylesheet">
<script>
window.esmsInitOptions = { enable: ['css-modules', 'json-modules'] }
</script>
<script async src="https://unpkg.com/es-module-shims/dist/es-module-shims.js"></script>
<body>
<div class="container mx-auto p-8">
<h1 class="text-3xl font-semibold mb-2">Tailwind Stimulus Components Alert Examples</h1>
Expand Down Expand Up @@ -62,11 +66,13 @@ <h1 class="text-3xl font-semibold mb-2">Tailwind Stimulus Components Alert Examp
"imports": {
"@hotwired/stimulus": "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js",
"tailwindcss-stimulus-components": "https://unpkg.com/tailwindcss-stimulus-components/dist/tailwindcss-stimulus-components.modern.js"
// Uncomment to use local package with "npx serve"
//"tailwindcss-stimulus-components": "../dist/tailwindcss-stimulus-components.modern.js"
}
}
</script>
<!--
Use the following importmap for local package with "npx serve"
"tailwindcss-stimulus-components": "../dist/tailwindcss-stimulus-components.modern.js"
-->

<script type="module">
import { Application } from "@hotwired/stimulus"
Expand Down
12 changes: 9 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
<title>Tailwind Stimulus Components</title>
<link href="https://unpkg.com/tailwindcss/dist/tailwind.min.css" rel="stylesheet">
<link href="https://unpkg.com/@tailwindcss/forms/dist/forms.min.css" rel="stylesheet">
</head>
<script>
window.esmsInitOptions = { enable: ['css-modules', 'json-modules'] }
</script>
<script async src="https://unpkg.com/es-module-shims/dist/es-module-shims.js"></script>
</head>
<body>
<div class="container mx-auto p-8"
data-controller="slideover"
Expand Down Expand Up @@ -290,11 +294,13 @@ <h2 class="text-2xl text-gray-800 font-semibold mb-4">Color Picker and Preview</
"imports": {
"@hotwired/stimulus": "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js",
"tailwindcss-stimulus-components": "https://unpkg.com/tailwindcss-stimulus-components/dist/tailwindcss-stimulus-components.modern.js"
// Uncomment to use local package with "npx serve"
//"tailwindcss-stimulus-components": "../dist/tailwindcss-stimulus-components.modern.js"
}
}
</script>
<!--
Use the following importmap for local package with "npx serve"
"tailwindcss-stimulus-components": "../dist/tailwindcss-stimulus-components.modern.js"
-->

<script type="module">
import { Application } from "@hotwired/stimulus"
Expand Down

0 comments on commit 7727f3a

Please sign in to comment.