Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically handling URLs in /docs/demos to make development easier #3157

Open
jodeleeuw opened this issue Oct 19, 2023 · 0 comments
Open

Comments

@jodeleeuw
Copy link
Member

The /docs/demos folder has many HTML files that serve as the interactive demos on the documentation site.

These import jspsych scripts from unpkg. Here's a typical example.

<script src="https://unpkg.com/jspsych@7.3.3"></script>
<script src="https://unpkg.com/@jspsych/plugin-animation@1.1.2"></script>
<script src="https://unpkg.com/@jspsych/plugin-preload@1.1.2"></script>
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.2"></script>
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.3/css/jspsych.css" />

When developing locally, if you are working with modified, unpublished code then you have to change these references to local build files. Here's what this looks like for one example I'm working on.

<head>
    <script src="docs-demo-timeline.js"></script>
    <script src="https://unpkg.com/jspsych@7.3.3"></script>
    <!-- <script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.1.2"></script> -->
    <script src="../../packages/plugin-html-button-response/dist/index.browser.js"></script>
    <!-- <link rel="stylesheet" href="https://unpkg.com/jspsych@7.3.3/css/jspsych.css" /> -->
    <link rel="stylesheet" href="../../packages/jspsych/css/jspsych.css" />
    <link rel="stylesheet" href="docs-demo.css" type="text/css">
</head>

It would be nice to allow these to be local paths in the repo, but then change them to the relevant unpkg URL when we build the documentation. Then the examples would be easier to build and would serve as local manual test files for development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant