shipshapecode / shipshapecode/shepherd
[Question] Demo: Shepherd is not defined
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13.8k
- Forks
- 658
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 15
Description
I'm not a power user of js, for the least. But in the the "demo", Shepherd module is imported in a script tag:
index.html
<link rel="stylesheet" href="shepherd.js/dist/css/shepherd.css"/>
<script type="module" src="shepherd.js/dist/shepherd.mjs"></script>
<script src="demoScript.js"></script>
When imported like this, there is an error in the demo script, Shepherd is not defined.
For the example to work, i had to do differently:
index.html
<link rel="stylesheet" href="shepherd.js/dist/css/shepherd.css"/>
<script type="module" src="demoScript.js"></script>
demoScript.js
import Shepherd from "shepherd.js/dist/shepherd.mjs"
const tour = new Shepherd.Tour({
defaultStepOptions: {
cancelIcon: {
enabled: true
},
classes: 'class-1 class-2',
scrollTo: { behavior: 'smooth', block: 'center' }
}
});
//........
Question are, what did I miss, and how it is supposed to work with this import:
<script type="module" src="shepherd.js/dist/shepherd.mjs"></script> ?
I think a jsfiddle would be much more didactic than the current demo page.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the script tags in index.html and the Shepherd usage in demoScript.js. Reproduce the demo with the module script as shown, then compare it with the working import in demoScript.js. Done means the demo loads without “Shepherd is not defined” and the intended import usage is clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100