pyscript-cli icon indicating copy to clipboard operation
pyscript-cli copied to clipboard

Add option for src=<file>.py

Open AlbertDeFusco opened this issue 3 years ago • 1 comments

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>

AlbertDeFusco avatar Aug 14 '22 01:08 AlbertDeFusco

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).

mattkram avatar Aug 14 '22 02:08 mattkram