Skip to content

Add option for src=<file>.py #21

Open

Description

@AlbertDeFusco

Instead of copying the contents of the script into the HTML I would like to have the option to declare the path to the source input.

I will submit a PR for this use case shortly.

For example (the new flag is only a suggestion, a better recommended name or default behavior is appreciated)

> pyscript wrap --no-copy-source input-file.py -o index.html
> cat index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>PyScript App</title>
    <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css"/>
    <script defer src="https://pyscript.net/alpha/pyscript.js"></script>
</head>
<body>
    <py-script src="input-file.py"></py-script>
</body>
</html>

Activity

  1. mattkram commented on Aug 14, 2022

    @mattkram
    Contributor

    I wasn't aware the src= attribute worked for <py-script>. Cool!

    Definitely open for this and also potentially a way to put the source file into paths:.

    My original method was really intended to make a single static file, without need for web server at all, but I think there are many valid use cases and we should make it very configurable (and simple too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions