google/playground-elements

Playground file not found with direct config

jpoehnelt opened this issue · 5 comments

Ran into the following case where the key in the files map caused a Playground file not found even when content was set.

const failure = document.createElement('playground-ide');

failure.config = {
    files: {
        "some/long/path/to/file.html": {
            content: `<!DOCTYPE html><body><h1>Hello World</h1></body>`,
            label: "index.html"
        }
    }
}

document.body.appendChild(failure);

const success = document.createElement('playground-ide');

success.config = {
    files: {
        "index.html": {
            content: `<!DOCTYPE html><body><h1>Hello World</h1></body>`,
            label: "index.html"
        }
    }
}

document.body.appendChild(success);

The failure playground result is Playground file not found.

Screenshot

Reproducible example at: https://github.com/jpoehnelt/playground-elements-reproducible

Probably related to #235.

My particular use case is having a different project structure where index.html file may be in a src/ folder and the project config is in the root.

Currently the preview always looks for index.html. There is no way to tell it to render another HTML file.

My particular use case is having a remote index.html file.

By remote do you mean some external URL -- not a file in the project? Curious about that use case, can you give some more details (in particular, why it can't be a project file).

Probably related to #235.

Yep, related to #235 and also #239. The latter would allow configuring which HTML file is being displayed by setting an attribute/property on the preview component.

#239 seems like it would be sufficient

by "remote" I mean project file

Just published your fix as playground-elements@0.14.8