fix autogenerated element (#397)

* use static string in checkId to simplify behaviour and ensure ids always start with alpha char

* re-enable terser on minify

* fix example local path
This commit is contained in:
Fabio Pliger
2022-05-16 16:08:28 -05:00
committed by GitHub
parent eba42ad9b4
commit 0476627f34
3 changed files with 3 additions and 3 deletions

View File

@@ -18,7 +18,7 @@
<body class="container"> <body class="container">
<!-- <py-repl id="my-repl" auto-generate="true"> </py-repl> --> <!-- <py-repl id="my-repl" auto-generate="true"> </py-repl> -->
<py-script src="/todo.py"> </py-script> <py-script src="./todo.py"> </py-script>
<main class="max-w-xs mx-auto mt-4"> <main class="max-w-xs mx-auto mt-4">
<section> <section>

View File

@@ -84,7 +84,7 @@ export default {
file: "examples/build/pyscript.min.js", file: "examples/build/pyscript.min.js",
format: "iife", format: "iife",
sourcemap: true, sourcemap: true,
// plugins: [terser()], plugins: [terser()],
}, },
], ],
plugins: [ plugins: [

View File

@@ -54,7 +54,7 @@ export class BaseEvalElement extends HTMLElement {
} }
checkId() { checkId() {
if (!this.id) this.id = this.constructor.name + '-' + guidGenerator(); if (!this.id) this.id = 'py-' + guidGenerator();
} }
getSourceFromElement(): string { getSourceFromElement(): string {