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

Remove all .ex references from example code #3386

Open
KokoDoko opened this issue Mar 16, 2025 · 4 comments
Open

Remove all .ex references from example code #3386

KokoDoko opened this issue Mar 16, 2025 · 4 comments
Labels
docs Relating to documentation in any way

Comments

@KokoDoko
Copy link

KokoDoko commented Mar 16, 2025

Problem

Currently there are three ways to work with excalibur:

  • create a vite project
  • import excalibur modules via esm.sh
  • put a script tag in the top of the html document

The last approach (script tag) requires a different approach to using classes, you have to put ex. in front of classnames. The other approaches do not need this.

In the excalibur quickstart the vite approach is taught.
In the excalibur fundementals the ex. approach is taught.

I have found that this is confusing for new game developers.

Proposal

Using ex. seems not needed anymore since we can now use import { Actor, Engine } from 'https://esm.sh/excalibur';

For that reason I propose to remove .ex prefix from tutorials and documentation and only use the modules based approach.

@eonarheim
Copy link
Member

@KokoDoko I can see the desire, the modules approach is definitely the way of the ESM future.

Originally we had done the ex prefix to make clear what was coming out of excalibur in the tutorial documentation, but maybe that's a flimsy reason nowadays.

I'm down to make this consistent with the new world order, @kamranayub @mattjennings @jyoung4242 any thoughts here?

@eonarheim eonarheim added the docs Relating to documentation in any way label Apr 3, 2025
@mattjennings
Copy link
Contributor

After thinking about this a bit, I think I agree. It's a convention that is established but is only really used in non-ESM environments.

We should probably include this in the setup code as a convention:

import * as ex from 'https://esm.sh/excalibur'
import * as ex from 'excalibur'

Then we may or may not want to also include this in example code. If we establish this in every method, maybe we can get away with not needing to inject that boilerplate every time.

@jyoung4242
Copy link
Contributor

I personally don't use the ex import, i import each module independently. That being said, we should present a unified front in our documentation, and this is a key element IMO... just will take some work. But I agree with it being more forward looking...

@eonarheim
Copy link
Member

Cool cool, I'll support removing import * as ex from all the places. Thanks for bringing this up @KokoDoko!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Relating to documentation in any way
Projects
None yet
Development

No branches or pull requests

4 participants