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

PCUI Examples #228

Merged
merged 12 commits into from
Jan 1, 2023
Merged

PCUI Examples #228

merged 12 commits into from
Jan 1, 2023

Conversation

willeastcott
Copy link
Contributor

@willeastcott willeastcott commented Dec 31, 2022

Added a set of simple examples for PCUI. Examples are:

  • Minimal. Examples average about 50 lines each.
  • Single page. No external dependencies beyond loading PCUI from unpkg.com.
  • ES Module-based. Modern JS with ES Modules and Import Maps. No need for a build step using Rollup/Webpack/etc.

I've also added a basic index.html which uses PCUI to create a simple examples browser type application:

pcui-examples

For PCUI developers, the examples are good for:

  • Debugging/developing individual elements/modules. By default, examples load the last NPM release of PCUI (via unpkg.com). To run against a local PCUI build, simply edit the import maps to relative paths.
  • Sanity checking PCUI before generating a new release.

@willeastcott willeastcott added the enhancement New feature or request label Dec 31, 2022
@willeastcott willeastcott requested a review from a team December 31, 2022 10:25
@willeastcott willeastcott self-assigned this Dec 31, 2022
Copy link
Member

@slimbuck slimbuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all the examples appear to have the same HTML head, I wonder whether it wouldn't be better for each example to be just the script in each .html->body->script and do away with the duplication?

examples/colorpicker.html Outdated Show resolved Hide resolved
examples/index.html Outdated Show resolved Hide resolved
@willeastcott
Copy link
Contributor Author

willeastcott commented Jan 1, 2023

@slimbuck I know the duplication isn't ideal, but a developer can open any example and see how everything works straight away. No jumping between css/js/html files. At first, I did have the css in a common.css file but I moved it back into the html files. If you contrast this with the PlayCanvas Engine Examples Browser, there it's not obvious how to set up a project from scratch. Here, nothing is hidden and I kind of really like that. But totally open to debate on this as there's definitely no solution that is perfect. 😄

@willeastcott willeastcott merged commit af10336 into main Jan 1, 2023
@willeastcott willeastcott deleted the examples branch January 1, 2023 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants